Show last authors
1 This page describes the algorithm's five main phases and the available implementations. You can find a list and descriptions of the intermediate processors [[over here>>doc:Intermediate Processors]].
2
3 == Phase 1: Cycle Removal ==
4
5 The first phase makes sure that the graph doesn't contain any cycles. In some papers, this phase is an implicated part of the layering. This is due to the supporting function cycle removal has for layering: without cycles, we can find a topological ordering of the graph's nodes, which greatly simplifies layering.
6
7 An important part to note is that cycles may not be broken by removing one of their edges. If we did that, the edge would not be routed later, not to speak of other complications that would ensue. Instead, cycles must be broken by reversing one of their edges. Since the problem of finding the minimal set of edges to reverse to make a graph cycle-free is NP-hard, (or NP-complete? I don't remember from the top of my head) cycle removers will implement some heuristic to do their work.
8
9 The reversed edges have to be restored at some point. There's a processor for that, called ReversedEdgeRestorer. All implementations of phase one must include a dependency on that processor, to be included after phase 5.
10
11 |=(((
12 Preconditions
13 )))|=(% class="nohighlight" %)(% class="nohighlight" %)
14 (((
15 * No node is assigned to a layer yet.
16 )))
17 |(% class="highlight" %)(% class="highlight" %)
18 (((
19 Postconditions
20 )))|(((
21 * The graph is now cycle-free. Still, no node is assigned to a layer yet.
22 )))
23 |(% class="highlight" %)(% class="highlight" %)
24 (((
25 Remarks
26 )))|(((
27 * All implementations of phase one must include a dependency on the {{code language="none"}}ReversedEdgeRestorer{{/code}}, to be included after phase five.
28 )))
29 |(% class="highlight" %)(% class="highlight" %)
30 (((
31 Implementations
32 )))|(((
33 * {{code language="none"}}GreedyCycleBreaker{{/code}}. Uses a greedy approach to cycle-breaking, inspired by \\
34 ** Peter Eades, Xuemin Lin, W. F. Smyth, A fast and effective heuristic for the feedback arc set problem. //Information Processing Letters// 47(6), pp. 319-323, 1993.
35 * {{code language="none"}}InteractiveCycleBreaker.{{/code}} Detects feedback edges according to the current layout, hence it reacts to the user's placement.
36 )))
37
38 == Phase 2: Layering ==
39
40 The second phase assigns nodes to layers. (also called //ranks// in some papers) Nodes in the same layer are assigned the same x coordinate. (give or take) The problem to solve here is to assign each node x a layer i such that each successor of x is in a layer j>i. The only exception are self-loops, that may or may not be supported by later phases.
41
42 It must be differentiated between a //layering// and a //proper layering//. In a layering, the above condition holds. (well, and self-loops are allowed) In a proper layering, each successor of x is required to be assigned to layer i+1. This is possible only for the simplest cases, but may be required by later phases. In that case, later phases use the LongEdgeSplitter processor to turn a layering into a proper layering by inserting dummy nodes as necessary.
43
44 Note that nodes can have a property associated with them that constraints the layers they can be placed in.
45
46 |=(((
47 Preconditions
48 )))|=(% class="nohighlight" %)(% class="nohighlight" %)
49 (((
50 * The graph is cycle-free.
51 * The nodes have not been layered yet.
52 )))
53 |(% class="highlight" %)(% class="highlight" %)
54 (((
55 Postconditions
56 )))|(((
57 * The graph has a layering.
58 )))
59 |(% class="highlight" %)(% class="highlight" %)
60 (((
61 Remarks
62 )))|(((
63 * Implementations should usually include a dependency on the {{code language="none"}}LayerConstraintHandler{{/code}}, unless they already adhere to layer constraints themselves.
64 )))
65 |(% class="highlight" %)(% class="highlight" %)
66 (((
67 Implementations
68 )))|(((
69 * {{code language="none"}}LongestPathLayerer{{/code}}. Layers nodes according to the longest paths between them. Very simple, and doesn't usually give the best results.
70 * {{code language="none"}}NetworkSimplexLayerer{{/code}}. A way more sophisticated algorithm whose results are usually very good, inspired by\\
71 ** (((
72 Emden R. Gansner, Eleftherios Koutsofios, Stephen C. North, Kiem-Phong Vo, A technique for drawing directed graphs. //Software Engineering// 19(3), pp. 214-230, 1993.
73 )))
74 * {{code language="none"}}InteractiveLayerer.{{/code}} Detects layers according to the current layout, hence it reacts to the user's placement.
75 )))
76
77 == Phase 3: Crossing Reduction ==
78
79 The objective of phase 3 is to determine how the nodes in each layer should be ordered. The order determines the number of edge crossings, and thus is a critical step towards readable diagrams. Unfortunately, the problem is NP-hard even for only two layers. Did I just hear you say "heuristic"? The usual approach is to sweep through the pairs of layers from left to right and back, along the way applying some heuristic to minimize crossings between each pair of layers. The two most prominent and well-studied kinds of heuristics used here are the barycenter method and the median method. We have currently implemented the former.
80
81 Our crossing reduction implementations may or may not support the concepts of node successor constraints and layout groups. The former allows a node x to specify a node y!=x that may only appear after x. Layout groups are groups of nodes. Nodes belonging to different layout groups are not to be interleaved.
82
83 |=(((
84 Preconditions
85 )))|=(% class="nohighlight" %)(% class="nohighlight" %)
86 (((
87 * The graph has a proper layering. (except for self-loops)
88 * An implementation may allow in-layer connections.
89 * Usually, all nodes are required to have a least fixed port sides.
90 )))
91 |(% class="highlight" %)(% class="highlight" %)
92 (((
93 Postconditions
94 )))|(((
95 * The order of nodes in each layer is fixed.
96 * All nodes have a fixed port order.
97 )))
98 |(% class="highlight" %)(% class="highlight" %)
99 (((
100 Remarks
101 )))|(((
102 * If fixed port sides are required, the {{code language="none"}}PortPositionProcessor{{/code}} may be of use.
103 * Support for in-layer connections may be required to be able to handle certain problems. (odd port sides, for instance)
104 )))
105 |(% class="highlight" %)(% class="highlight" %)
106 (((
107 Implementations
108 )))|(((
109 * {{code language="none"}}LayerSweepCrossingMinmizer{{/code}}. Does several sweeps across the layers, minimizing the crossings between each pair of layers using a barycenter heuristic. Supports node successor constraints and layout groups. Node successor constraints require one node to appear before another node. Layout groups specify sets of nodes whose nodes must not be interleaved. See [[this page>>doc:Layer Sweep Crossing Minimization]] for more information.
110 * {{code language="none"}}InteractiveCrossingMinimizer.{{/code}} Detects the order of nodes according to the current layout, hence it reacts to the user's placement.
111 )))
112
113 == Phase 4: Node Placement ==
114
115 So far, the coordinates of the nodes have not been touched. That's about to change in phase 4, which determines the y coordinate. While phase 3 has an impact on the number of edge crossings, phase 4 has an influence on the number of edge bends. Usually, some kind of heuristic is employed to yield a good y coordinate.
116
117 Our node placers may or may not support node margins. Node margins define the space occupied by ports, labels and such. The idea is to keep that space free from edges and other nodes.
118
119 |=(((
120 Preconditions
121 )))|=(% class="nohighlight" %)(% class="nohighlight" %)
122 (((
123 * The graph has a proper layering. (except for self-loops)
124 * Node orders are fixed.
125 * Port positions are fixed.
126 * An implementation may allow in-layer connections.
127 * An implementation may require node margins to be set.
128 )))
129 |(% class="highlight" %)(% class="highlight" %)
130 (((
131 Postconditions
132 )))|(((
133 * Each node is assigned a y coordinate such that no two nodes overlap.
134 * The height of each layer is set.
135 * The height of the graph is set to the maximal layer height.
136 )))
137 |(% class="highlight" %)(% class="highlight" %)
138 (((
139 Remarks
140 )))|(((
141 * Support for in-layer connections may be required to be able to handle certain problems. (odd port sides, for instance)
142 * If node margins are supported, the {{code language="none"}}NodeMarginCalculator{{/code}} can compute them.
143 * Port positions can be fixed by using the {{code language="none"}}PortPositionProcessor{{/code}}.
144 )))
145 |(% class="highlight" %)(% class="highlight" %)
146 (((
147 Implementations
148 )))|(((
149 * {{code language="none"}}LinearSegmentsNodePlacer{{/code}}. Builds linear segments of nodes that should have the same y coordinate and tries to respect those linear segments. Linear segments are placed according to a barycenter heuristic. Inspired by\\
150 ** (((
151 Georg Sander, A fast heuristic for hierarchical Manhattan layout. In //Proceedings of the Symposium on Graph Drawing (GD'95)//, LNCS vol. 1027, pp. 447-458, Springer, 1996.
152 )))
153 * {{code language="none"}}BKNodePlacer.{{/code}} ??? Inspired by\\
154 ** (((
155 Ulrik Brandes and Boris Köpf, Fast and simple horizontal coordinate assignment. In //Proceedings of the 9th International Symposium on Graph Drawing (GD'01)//, LNCS vol. 2265, pp. 33-36, Springer, 2002.
156 )))
157 )))
158
159 == Phase 5: Edge Routing ==
160
161 In the last phase, it's time to determine x coordinates for all nodes and route the edges. The routing may support very different kinds of features, such as support for odd port sides, (input ports that are on the node's right side) orthogonal edges, spline edges etc. Often times, the set of features supported by an edge router largely determines the intermediate processors used during the layout process.
162
163 |=(((
164 Preconditions
165 )))|=(% class="nohighlight" %)(% class="nohighlight" %)
166 (((
167 * The graph has a proper layering. (except for self-loops)
168 * Nodes are assigned y coordinates.
169 * Layer heights are correctly set.
170 * An implementation may allow in-layer connections.
171 )))
172 |(% class="highlight" %)(% class="highlight" %)
173 (((
174 Postconditions
175 )))|(((
176 * Nodes are assigned x coordinates.
177 * Layer widths are set.
178 * The graph's width is set.
179 * The bend points of all edges are set.
180 )))
181 |(% class="highlight" %)(% class="highlight" %)
182 (((
183 Remarks
184 )))|(((
185 None.
186 )))
187 |(% class="highlight" %)(% class="highlight" %)
188 (((
189 Implementations
190 )))|(((
191 * {{code language="none"}}OrthogonalEdgeRouter{{/code}}. Routes edges orthogonally. Supports routing edges going into an eastern port around a node. Tries to minimize the width of the space between each pair of layers used for edge routing. Inspired by\\
192 ** (((
193 Georg Sander, Layout of directed hypergraphs with orthogonal hyperedges. In //Proceedings of the 11th International Symposium on Graph Drawing (GD '03)//, LNCS vol. 2912, pp. 381-386, Springer, 2004.
194 )))
195 * {{code language="none"}}PolylineEdgeRouter{{/code}}. Simplest routing style that just inserts bend points at the position of long edge dummy nodes.
196 * {{code language="none"}}SplineEdgeRouter{{/code}}. A simple method for routing the edges with splines. Uses the long edge dummy nodes as reference points for spline calculation.
197 )))