21
Straight line drawings of planar graphs – part II Roeland Luitwieler

Straight line drawings of planar graphs – part II Roeland Luitwieler

Embed Size (px)

Citation preview

Page 1: Straight line drawings of planar graphs – part II Roeland Luitwieler

Straight line drawings of planar graphs – part II

Roeland Luitwieler

Page 2: Straight line drawings of planar graphs – part II Roeland Luitwieler

Outline

• Reminder• The realizer method

– Barycentric representations– Schnyder labelings and realizers– The realizer algorithm

Page 3: Straight line drawings of planar graphs – part II Roeland Luitwieler

Reminder

• This presentation is about:– Straight line grid drawings of planar

graphs– Minimized area

• De Fraysseix, Pach & Pollack, 1988:– The shift method: 2n–4 x n–2 grid

• Schnyder, 1990:– The realizer method: n–2 x n–2 grid

• Both are quite different, but can be implemented as linear time algorithms

Page 4: Straight line drawings of planar graphs – part II Roeland Luitwieler

Reminder

• Assumptions (can be taken care of in linear time)– n ≥ 3 (trivial otherwise)– Graph is maximal planar (=triangulated)– Graph has a topological embedding

• Previously:– We proved every triangulated plane graph has a

canonical ordering, which can be obtained in linear time– We showed how the linear-time shift algorithm works

• Adds vertices in a canonical ordering• Shifts parts of the drawing to enable straight lines• Always uses a 2n–4 x n–2 grid

Page 5: Straight line drawings of planar graphs – part II Roeland Luitwieler

Barycentric representations

• A barycentric representation of a graph G is an injective function f : v ∈ V(G) → (v1, v2, v3) ∈ ℝ3 such that– v1 + v2 + v3 = 1 for all v ∈ V(G)

– For each edge (x, y) and vertex z ≠ x, y there exists anindex k ∈ {1, 2, 3} such that xk < zk and yk < zk

• (v1, v2, v3) are barycentric coordinates of v

Page 6: Straight line drawings of planar graphs – part II Roeland Luitwieler

Barycentric representations

• So, a barycentric representation of a graph is a planar straight line drawing in the plane spanned by the three points (1, 0, 0), (0, 1, 0) and (0, 0, 1)

• Only a planar graph can have a barycentric representation

Page 7: Straight line drawings of planar graphs – part II Roeland Luitwieler

Barycentric representations

• A weak barycentric representation of a graph G is an injective function f : v ∈ V(G) → (v1, v2, v3) ∈ ℝ3 such that– v1 + v2 + v3 = 1 for all v ∈ V(G)

– For each edge (x, y) and vertex z ≠ x, y there exists an indexk ∈ {1, 2, 3} such that(xk, xk+1) <lex (zk, zk+1) and

(yk, yk+1) <lex (zk, zk+1), where

indices are computed modulo 3• Note:

(a, b) <lex (c, d) ≡ a < c or (a == c and b < d)

Page 8: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

• A Schnyder labeling is a labeling of all angles of all inner facial triangles of a triangulated plane graph with labels 1, 2, 3 such that:– The angles of each inner facial triangle are labeled 1, 2

and 3 in counterclockwise order– The labels of the angles at each inner vertex form

nonempty intervals of 1’s, 2’s and 3’s in counterclockwise order

Page 9: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

• Lemma: Every triangulated plane graph has a Schnyder labeling

• Proof: use canonical ordering– Contract inner edges (vn, vn-1), (vn, vn-2), …

• Edge contractible if graph remains triangulated (proof follows)

– Label all angles at vn 1

– Now expand again in reverse order, like this (where a=vn):

Page 10: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

– Subproof: edges (vn, vn-1), (vn, vn-2), … are contractible• The vertices of a contractible edge have exactly two

common neighbours• This holds in a canonical ordering

– vn remains the neighbour of all vertices on the outer cycle of the rest of the graph (Gk), including vk

– So, vn and vk have the most left and the most right neighbour of vk on the outer cycle of Gk-1 in common

Page 11: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

• A realizer is a partition of the inner edges into sets T1, T2 and T3 such that for each inner vertex v:– v has outdegree one in each of the sets– The counterclockwise order

of the incident edges is:

• Schnyder labelingsand realizers areequivalent notions

Page 12: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

• Here’s a triangulated plane graph with a corresponding Schnyder labeling and realizer:

Page 13: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

• We define Pi(v) the i-path of an inner vertex v to be the path in Ti from v to the root of Ti

• P1(v), P2(v) and P3(v) share only the vertex v

• They divide the graph into three regions R1(v), R2(v) and R3(v), each opposite to the resp. root

Page 14: Straight line drawings of planar graphs – part II Roeland Luitwieler

Schnyder labelings and realizers

• By Pi(v) we also denote the set of vertices on that path

• By Ri(v) we also denote the set of all vertices in that region– The vertices on Pi+1(v) and Pi-1(v) are included

• For all distinct inner vertices u and v of a triangulated plane graph, we have:– if u ∈ Ri(v) then Ri(u) ⊂ Ri(v)

Page 15: Straight line drawings of planar graphs – part II Roeland Luitwieler

The realizer algorithm

• For an inner vertex v let ni(v) = |Ri(v) – Pi–1(v)|

• For an outer vertex (root) ri let

ni(ri) = n – 2, ni+1(ri) = 1 and ni+2(ri) = 0

• Note that for all vertices v: n1(v) + n2(v) + n3(v) = n – 1

• Also note that: 0 ≤ n1(v), n2(v), n3(v) ≤ n – 2

• Furthermore:if u ∈ (Ri(v) – Pi-1(v)) then ni(u) < ni(v)– Case u is outer vertex ri+1: ni(u) = 0

– Case u is an inner vertex: Ri(u) ⊂ Ri(v)

if u ∈ Ri(v) then ni(u) ≤ ni(v)– Cases above apply

– Case u is outer vertex ri–1: ni(u) = 1

Page 16: Straight line drawings of planar graphs – part II Roeland Luitwieler

The realizer algorithm

• Lemma: We now have that the function

f : v ∈ V(G) → 1/(n – 1) · (n1(v), n2(v), n3(v)) ∈ ℝ3

is a weak barycentric representation of the triangulated plane graph G

• Proof:– v1 + v2 + v3 = 1 for all v ∈ V(G), since n1(v) + n2(v) + n3(v)

= n – 1– We now only have to show that for each edge (x, y) and

vertex z ≠ x, y there exists an index k ∈ {1, 2, 3} such that(xk, xk+1) <lex (zk, zk+1) and (yk, yk+1) <lex (zk, zk+1)

Page 17: Straight line drawings of planar graphs – part II Roeland Luitwieler

The realizer algorithm

– Proof that for each edge (x, y) and vertex z ≠ x, y there exists an index k ∈ {1, 2, 3} such that (xk, xk+1) <lex (zk, zk+1) and

(yk, yk+1) <lex (zk, zk+1):

• Case z is an outer vertex ri: k=i implies nk(x), nk(y) < nk(z) = n – 2

• Case z is an inner vertex: some k exists such that x, y ∈ Rk(z)

Now for u ∈ {x, y} and v = z:– Case u ∈ (Rk(v) – Pk-1(v)): we showed for that case nk(u) < nk(v)

– Case u ∈ Pk-1(v): we showed maybe nk(u) = nk(v); but then u ∈ (Rk+1(v) – Pk(v)), so nk+1(u) < nk+1(v)

Page 18: Straight line drawings of planar graphs – part II Roeland Luitwieler

The realizer algorithm

• The algorithm is as follows:– Construct Schnyder labeling and realizer– For all vertices v do

• Calculate n1(v) and n2(v)

• Draw v at coordinates (n1(v), n2(v))

• Correctness:– The plane spanned by (n – 1, 0, 0), (0, n – 1, 0) and (0, 0, 0) is

2D

• Complexity:– Calculate in linear time: for all v the depth and the size of the

subtree rooted at v

– All |Pi-1(v))| and |Ri(v)| can be calculated from this in constant time per vertex, so all ni(v) too

Page 19: Straight line drawings of planar graphs – part II Roeland Luitwieler

The realizer algorithm

• Here’s a drawing obtained by the algorithm:

Page 20: Straight line drawings of planar graphs – part II Roeland Luitwieler

Conclusions

• The realizer method uses– A Schnyder labeling and realizer– A n–2 x n–2 grid– Linear time

• Questions?

Page 21: Straight line drawings of planar graphs – part II Roeland Luitwieler

References• H. de Fraysseix, J. Pach and R. Pollack, How to draw a

planar graph on a grid, Combinatorica 10 (1), 1990, pp. 41–51.

• T. Nishizeki and Md. S. Rahman, Planar Graph Drawing, World Scientific, Singapore, 2004, pp. 45–88.

• W. Schnyder, Embedding planar graphs on the grid, in: Proceedings of the First ACM-SIAM Symposium on Discrete Algorithms, 1990, pp. 138–148.