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).
- Version:
- $Id: $Id
- 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.voidSets the progress listener.voidsetRandomlyInitialized(boolean randomlyInitialized) Sets whether the spring layout should start from a randomly initialized 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 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
Sets the progress listener. Pass aLayoutUtil.NoOpProgressListenerfor headless use.- Parameters:
listener- the listener to use.
-