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).
Author:
josephramsey
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new Kamada-Kawai layout for the given graph.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Lays out the graph.
    void
    setNaturalEdgeLength(double naturalEdgeLength)
    Sets the natural length of an edge.
    void
    setRandomlyInitialized(boolean randomlyInitialized)
    Sets whether the spring layout should start from a randomlyInitialized position or from the getModel positions of the nodes.
    void
    setSpringConstant(double springConstant)
    Sets the spring constant; higher for more elasticity.
    void
    setStopEnergy(double stopEnergy)
    Sets the max delta at which the algorithm will stop settling.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 randomlyInitialized position or from the getModel positions of the nodes.
      Parameters:
      randomlyInitialized - true if the spring layout should start from a randomlyInitialized position, false if the spring layout should start from the getModel positions of the nodes.
    • 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 settling.
    • 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; higher for more elasticity.