Package edu.cmu.tetrad.graph
Class LayoutUtil.KamadaKawaiLayout
java.lang.Object
edu.cmu.tetrad.graph.LayoutUtil.KamadaKawaiLayout
- Enclosing class:
LayoutUtil
Lays out a graph by placing springs between the nodes and letting the system settle (one node at a time).
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionKamadaKawaiLayout(Graph graph) Constructs a new Kamada-Kawai layout for the given graph. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoLayout()Lays out the graph.voidsetNaturalEdgeLength(double naturalEdgeLength) Sets the natural length of an edge.voidsetRandomlyInitialized(boolean randomlyInitialized) Sets whether the spring layout should start from a randomlyInitialized position or from the getModel positions of the nodes.voidsetSpringConstant(double springConstant) Sets the spring constant; higher for more elasticity.voidsetStopEnergy(double stopEnergy) Sets the max delta at which the algorithm will stop settling.
-
Constructor Details
-
KamadaKawaiLayout
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.
-