1
Orthogonal Drawing (continued)
Sections 8.3 – 8.5 from the book
Bert Spaan
2
Orthogonal Drawing (continued)
1. Linear Algorithm Without Bad Cycles With Bad Cycles
2. Orthogonal Grid Drawing
3. Orthogonal Drawings without Bends
3
Linear Algorithm for Bend-Optimal Drawing
Linear time algorithm for graphs with the following properties: 3-connected Δ ≤ 3 Four or more outer edges
4
k-Connectivity
A graph G is connected if for any distinct vertices u and v there is a path between u and v in G.
A graph is k-connected if the minimum number of vertices whose removal results in a disconnected graph is k.
5
Examples
1-connected:
2-connected:
3-connected:
6
Bad Cycles A graph has no bad cycles and thus a
rectangular drawing if and only if Any 2-legged cycle contains two or more
corners Any 3-legged cycle contains one or more
corners A bad cycle is a 2-legged cycle which
contains at most one corner, or a 3-legged cycle which contains no corners.
7
Maximal Bad Cycles A bad cycle C in G is defined to be maximal
if C is not contained in any other bad cycle in G
8
Linear AlgorithmAlgorithm Orthogonal-Draw(G)begin Add four dummy vertices of degree two on four distinct outer edges as the corners; Let G’ be the resulting graph; Let C1, C2 , …, Cl, be the maximal bad cycles in G’;
for each i, 1 ≤ i ≤ l, construct a genealogical tree TCi and determine green paths
and red paths for every cycle in TCi;
for each i, 1 ≤ i ≤ l, find an orthogonal drawing D(G(Ci)) of G(Ci) feasible for an arbitrary green path of Ci by Feasible-Draw;
Let G’’ be a plane graph derived from G’ by contracting each for each G(Ci), 1 ≤ i ≤ l, to a single vertex vi;
Find a rectangular drawing D(G’’) of G’’ by Rectangular-Draw; Patch the drawings D(G(C1, D(G(C2 )) , …, D(G(Cl )) into D(G’’) to get an orthogonal
drawing D(G’) of G’. Obtain an orthogonal drawing D(G) of G by replacing the four dummy vertices a, b,
c and d in D(G’) with bendsend.
9
Linear Algorithm Without Bad Cycles
Algorithm Orthogonal-Draw(G)begin Add four dummy vertices of degree two on four distinct outer edges as
the corners; Let G’ be the resulting graph; Obtain an orthogonal drawing D(G) of G by replacing the four dummy
vertices a, b, c and d in D(G’) with bendsend.
10
Example Start:
Step 2:
Step 1:
Step 3:
11
Linear Algorithm With Bad Cycles, same Algorithm
Start:
Step 2:
Step 1:
Step 3:
Doesn’t lead to orthogonal drawing due to bad cycle
12
Bad Cycles in G’
G is 3-connected and thus has no 2-legged cycles
G’ has four 2-legged cycles, but none of those are bad cycles
Every bad cycle in G’ is a 3-legged cycle containing no corner
13
Genealogical Tree
Tree of cycles in G, TC
In algorithm: tree of 3-legged bad cycles
TC can be found in linear time
14
Example 3-legged cycles in
C and genealogical tree TC
C2, C3, C4 and C5 are the maximal bad cycles in C
C7 is the maximal bad cycle in C4
15
Assignment & Labeling For each 3-legged cycle C in graph G
we define the following terms in a recursive manner, based on a genealogical tree. C is divided into three contour paths
P1, P2, and P3 by the three leg-vertices x, y and z
Each contour path is classified as either a green path or a red path
C is assigned an integer bc(C), the bend-count of C
16
Three cases
1. C has no child-cycle, that is, l = 0
2. C has child-cycles C1, C2 , …, Cl , l ≥ 1, but none of them has a green path on C
3. Otherwise
17
Case 1
C has no child-cycles: TC consists of a single vertex Classify all the three contour
paths of C as green paths Set bc(C) = 1
18
Case 2
C has one or more child-cycles, none of them with a green path on C:
Classify all the three contour paths of C as green paths
Set bc(C) = 1 + the sum of the bend-counts of all child-cycles
19
Case 3
Otherwise: Classify the contour paths in
which a child-cycle has a green path as green paths
Classify the other contour paths (if any) as red paths
Set bc(C) = the sum of the bend-counts of all child-cycles
20
Properties
Each cycle has at least one green contour path
Assignment & Labeling can be done in linear time
21
Feasible-Draw
Find an orthogonal drawing G(C) for a 3-legged cycle C
Feasible if the drawing has the following properties: Drawing has bc(C) bends At least one bend appears on the green
path The drawing is bound by six open
halflines, two at each point x, y and z
22
Case 1C has no child-cycles: bc(C) = 1 Insert a dummy vertex t of degree two on an arbitrary
edge on the green path in C Now there are four corners:
Dummy vertex t Vertices x, y and z
No bad cycles, algorithm Rectangular-Draw can be used to find a rectangular drawing
After replacing t with a bend, an orthogonal drawing is created
23
Case 2C has one or more child-cycles, none of them with a green path on C: Recursion: first find an orthogonal drawing for each child-cycle Construct a plane graph J from G(C) by contracting each child-cycle
to a single vertex Add a dummy vertex t Now, with Rectangular-Draw and removal of t, an orthogonal
drawing can be found Replace the contracted vertices with the original child-cycles. This
is always possible, there are 12 distinct embeddings, depeding on the three legs x, y and z and the chosen green path
24
Case 3Otherwise Construct a plane graph J from G(C) by contracting each child-cycle
to a single vertex Replace one of the contracted cycles with a quadrangle (x1, t, y1,
z1) where t is a dummy vertext of degree two Recursion: find an orthogonal drawing for each child-cycle Now, with Rectangular-Draw and removal of t, an orthogonal
drawing can be found Replace the contracted vertices with the original child-cycles and
the quadrangle with its corresponding cycle.
25
Linear AlgorithmAlgorithm Orthogonal-Draw(G)begin Add four dummy vertices of degree two on four distinct outer edges as the corners; Let G’ be the resulting graph; Let C1, C2 , …, Cl, be the maximal bad cycles in G’;
for each i, 1 ≤ i ≤ l, construct a genealogical tree TCi and determine green paths
and red paths for every cycle in TCi;
for each i, 1 ≤ i ≤ l, find an orthogonal drawing D(G(Ci)) of G(Ci) feasible for an arbitrary green path of Ci by Feasible-Draw;
Let G’’ be a plane graph derived from G’ by contracting each for each G(Ci), 1 ≤ i ≤ l, to a single vertex vi;
Find a rectangular drawing D(G’’) of G’’ by Rectangular-Draw; Patch the drawings D(G(C1, D(G(C2 )) , …, D(G(Cl )) into D(G’’) to get an orthogonal
drawing D(G’) of G’. Obtain an orthogonal drawing D(G) of G by replacing the four dummy vertices a, b,
c and d in D(G’) with bendsend.
26
Orthogonal Grid Drawing An orthogonal drawing is called an
orthogonal grid drawing if all vertices and bends are located on integer grid points.
Dg D’g
27
Compact
Dg is compact: There is at least one vertical line
segment of x-coordinate i for each integer i, 0 ≤ i ≤ W(W is the width of the grid)
There is at least one horizontal line segment of y-coordinate j for each integer j, 0 ≤ j ≤ H(H is the height of the grid)
28
Bend-count and grid size relation
Let Dg be a compact orthogonal grid drawing of a plane graph G with b bends. Then W + H ≤ b + 2 * |E| – |V| – 2
29
Orthogonal Drawings without Bends
Plane graphs with Δ ≤ 3 may have an orthogonal drawing without bends
30
Conditions
Assume that G is a plane 2-connected graph with Δ ≤ 3 and four or more outer vertices of degree two.G has an orthogonal drawing without bends if and only if Every 2-legged cycle contains at least
two vertices of degree two Every 3-legged cycle contains at least
one vertex of degree two
31
Example 2-legged cycles:
3-legged cycles:
Top Related