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
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,
Point2D p)
Override forceMove so that if someone moves a node, we can re-layout
everything.
|
void |
setRoot()
Calculates the level of each vertex in the graph.
|
void |
setRoot(V v)
Set vertex v to be level 0.
|
void |
setSize(Dimension size)
When a visualization is resized, it presumably wants to fix the
locations of the vertices and possibly to reinitialize its data.
|
calculateRepulsion, getForceMultiplier, getRepulsionRange, getStretch, isIncremental, reset, setForceMultiplier, setRepulsionRange, setStretch, step
apply, getGraph, getSize, getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer
public void setRoot()
public void setRoot(V v)
v
- the vertex to set as rootpublic void propagateMinimumLevel(V v)
v
- the vertex whose minimum level is to be calculatedpublic void setSize(Dimension size)
AbstractLayout
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>
picked
- the vertex whose location is to be setx
- the x coordinate of the location to sety
- the y coordinate of the location to setpublic void setLocation(V picked, Point2D p)
setLocation
in interface Layout<V,E>
setLocation
in class AbstractLayout<V,E>
picked
- the vertex whose location is to be setp
- the location to setprotected void relaxEdges()
relaxEdges
in class SpringLayout<V,E>
Copyright © 2015. All rights reserved.