public class DAGLayout<V,E> extends SpringLayout<V,E>
Layout
suitable for tree-like directed
acyclic graphs. Parts of it will probably not terminate if the graph is
cyclic! The layout will result in directed edges pointing generally upwards.
Any vertices with no successors are considered to be level 0, and tend
towards the top of the layout. Any vertex has a level one greater than the
maximum level of all its successors.SpringLayout.SpringDimensionChecker, SpringLayout.SpringVertexData
force_multiplier, lengthFunction, repulsion_range_sq, springVertexData, stretch
graph, initialized, locations, size
Constructor and Description |
---|
DAGLayout()
Creates an instance which does not initialize the vertex locations.
|
DAGLayout(Graph<V,E> g)
Creates an instance for the specified graph.
|
Modifier and Type | Method and Description |
---|---|
boolean |
done()
Override incrementsAreDone so that we can eventually stop.
|
void |
initialize()
Had to override this one as well, to ensure that setRoot() is called.
|
protected void |
moveNodes()
Override the moveNodes() method from SpringLayout.
|
void |
propagateMinimumLevel(V v)
A recursive method for allocating the level for each vertex.
|
protected void |
relaxEdges()
Overridden relaxEdges.
|
void |
setLocation(V picked,
double x,
double y)
Override forceMove so that if someone moves a node, we can re-layout
everything.
|
void |
setLocation(V picked,
java.awt.geom.Point2D p)
Override forceMove so that if someone moves a node, we can re-layout
everything.
|
void |
setRoot(Graph<V,E> g)
setRoot calculates the level of each vertex in the graph.
|
void |
setRoot(V v)
Set vertex v to be level 0.
|
void |
setSize(java.awt.Dimension size)
Sets the dimensions of the available space for layout to
size . |
calculateRepulsion, getForceMultiplier, getRepulsionRange, getStretch, isIncremental, reset, setForceMultiplier, setRepulsionRange, setStretch, step
getGraph, getSize, getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer, transform
public DAGLayout()
public void setRoot(Graph<V,E> g)
public void setRoot(V v)
public void propagateMinimumLevel(V v)
v
- public void setSize(java.awt.Dimension size)
SpringLayout
size
.public void initialize()
initialize
in interface Layout<V,E>
initialize
in class SpringLayout<V,E>
protected void moveNodes()
moveNodes
in class SpringLayout<V,E>
public boolean done()
done
in interface IterativeContext
done
in class SpringLayout<V,E>
public void setLocation(V picked, double x, double y)
setLocation
in class AbstractLayout<V,E>
public void setLocation(V picked, java.awt.geom.Point2D p)
setLocation
in interface Layout<V,E>
setLocation
in class AbstractLayout<V,E>
protected void relaxEdges()
relaxEdges
in class SpringLayout<V,E>
Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence