Package org.eclipse.draw2d.graph
Class DirectedGraphLayout
java.lang.Object
org.eclipse.draw2d.graph.DirectedGraphLayout
- Direct Known Subclasses:
CompoundDirectedGraphLayout
Performs a graph layout of a
DirectedGraph
. The directed graph
must meet the following conditions:
- The graph must be connected.
- All edge's must be added to the graph's
edges
list exactly once. - All nodes must be added to the graph's
nodes
list exactly once.
- break cycles by inverting a set of feedback edges. Feedback edges will
have the flag
Edge.isFeedback
set totrue
. The following statements are true with respect to the inverted edge. When the algorithm completes, it will invert the edges again, but will leave the feedback flags set. - for each node n, assign n to a "rank" R(n), such that: for each edge (m, n) in n.incoming, R(m)<=R(n)-(m,n).delta. The total weighted edge lengths shall be no greater than is necessary to meet this requirement for all edges in the graph.
- attempt to order the nodes in their ranks as to minimize crossings.
- assign y coordinates to each node based on its rank. The spacing between ranks is the sum of the bottom padding of the previous rank, and the top padding of the next rank.
- assign x coordinates such that the graph is easily readable. The
exact behavior is undefined, but will favor edge's with higher
Edge.weight
s. The minimum x value assigned to a node or bendpoint will be 0. - assign bendpoints to all edge's which span more than 1 rank.
For each NODE:
- The x coordinate will be assigned a value >= 0
- The y coordinate will be assigned a value >= 0
- The rank will be assigned a value >=0
- The height will be set to the height of the tallest node on the same row
For each EDGE:
- If an edge spans more than 1 row, it will have a list of
virtual
nodes. The virtual nodes will be assigned an x coordinate indicating the routing path for that edge. - If an edge is a feedback edge, it's
isFeedback
flag will be set, and if it has virtual nodes, they will be in reverse order (bottom-up).
This class is not guaranteed to produce the same results for each invocation.
- Since:
- 2.1.2
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DirectedGraphLayout
public DirectedGraphLayout()- Since:
- 3.1
-
-
Method Details
-
visit
Lays out the given graph- Parameters:
graph
- the graph to layout
-