Package edu.cmu.tetrad.graph
Class LayoutUtil
java.lang.Object
edu.cmu.tetrad.graph.LayoutUtil
LayoutUtil class.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classLays out a graph by linearly summing repulsive force between all nodes and attractive force between adjacent nodes.static final classLays out a graph by placing springs between the nodes and letting the system settle (one node at a time). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidarrangeByLayout(Graph graph, HashMap<String, PointXy> layout) arrangeByLayout.static booleanarrangeBySourceGraph(Graph resultGraph, Graph sourceGraph) Arranges the nodes in the result graph according to their positions in the source graph.static voidcircleLayout(Graph graph) Arranges the nodes in the graph in a circle.static voiddefaultLayout(Graph graph) Arranges the nodes in the graph in a circle if there are 20 or fewer nodes, otherwise arranges them in a square.static voidfruchtermanReingoldLayout(Graph graph) fruchtermanReingoldLayout.static voidkamadaKawaiLayout(Graph graph, boolean randomlyInitialized, double naturalEdgeLength, double springConstant, double stopEnergy) kamadaKawaiLayout.static voidlayoutByCausalOrder(Graph graph) layoutByCausalOrder.static voidpositionLatentNode(Node latent, Set<Node> neighbors) Positions a latent node based on the average position of its measured neighbors.static voidrepositionLatents(Graph graph) Repositions latent nodes in the given graph based on their non-latent neighbors.static voidsquareLayout(Graph graph) squareLayout.
-
Constructor Details
-
LayoutUtil
public LayoutUtil()Constructor.
-
-
Method Details
-
kamadaKawaiLayout
public static void kamadaKawaiLayout(Graph graph, boolean randomlyInitialized, double naturalEdgeLength, double springConstant, double stopEnergy) kamadaKawaiLayout.
- Parameters:
graph- aGraphobjectrandomlyInitialized- a booleannaturalEdgeLength- a doublespringConstant- a doublestopEnergy- a double
-
fruchtermanReingoldLayout
fruchtermanReingoldLayout.
- Parameters:
graph- aGraphobject
-
arrangeByLayout
arrangeByLayout.
-
defaultLayout
Arranges the nodes in the graph in a circle if there are 20 or fewer nodes, otherwise arranges them in a square.- Parameters:
graph- the graph to be arranged.
-
circleLayout
Arranges the nodes in the graph in a circle.- Parameters:
graph- the graph to be arranged.
-
squareLayout
squareLayout.
- Parameters:
graph- aGraphobject
-
layoutByCausalOrder
layoutByCausalOrder.
- Parameters:
graph- aGraphobject
-
arrangeBySourceGraph
Arranges the nodes in the result graph according to their positions in the source graph. -
repositionLatents
Repositions latent nodes in the given graph based on their non-latent neighbors.This method iterates through all nodes in the graph, identifies latent nodes, and repositions them using the non-latent neighbors only. The method works by filtering out latent neighbors of each latent node before repositioning.
- Parameters:
graph- the graph containing the nodes to be repositioned.
-
positionLatentNode
Positions a latent node based on the average position of its measured neighbors. The method calculates the average x and y coordinates of the measured neighbors and repositions the latent node to this calculated center.- Parameters:
latent- the latent node to be positionedneighbors- the set of neighboring nodes; only measured neighbors are used to calculate the position
-