Class LayoutUtil.KamadaKawaiLayout

java.lang.Object
edu.cmu.tetrad.graph.LayoutUtil.KamadaKawaiLayout
Enclosing class:
LayoutUtil

public static final class LayoutUtil.KamadaKawaiLayout extends Object
Lays out a graph by placing springs between the nodes and letting the system settle (one node at a time).
Version:
$Id: $Id
Author:
josephramsey
  • Constructor Details

    • KamadaKawaiLayout

      public KamadaKawaiLayout(Graph graph)
      Constructs a new Kamada-Kawai layout for the given graph.
      Parameters:
      graph - the graph to be laid out.
  • Method Details

    • doLayout

      public void doLayout()
      Lays out the graph.
    • setRandomlyInitialized

      public void setRandomlyInitialized(boolean randomlyInitialized)
      Sets whether the spring layout should start from a randomly initialized position or from the getModel positions of the nodes.
      Parameters:
      randomlyInitialized - true for random start, false for current positions.
    • setStopEnergy

      public void setStopEnergy(double stopEnergy)
      Sets the max delta at which the algorithm will stop settling.
      Parameters:
      stopEnergy - the max delta at which the algorithm will stop.
    • setNaturalEdgeLength

      public void setNaturalEdgeLength(double naturalEdgeLength)
      Sets the natural length of an edge.
      Parameters:
      naturalEdgeLength - the natural length of an edge.
    • setSpringConstant

      public void setSpringConstant(double springConstant)
      Sets the spring constant; higher for more elasticity.
      Parameters:
      springConstant - the spring constant.
    • setProgressListener

      public void setProgressListener(LayoutUtil.LayoutProgressListener listener)
      Sets the progress listener. Pass a LayoutUtil.NoOpProgressListener for headless use.
      Parameters:
      listener - the listener to use.