Presentation is loading. Please wait.

Presentation is loading. Please wait.

Straight line drawings of planar graphs – part I Roeland Luitwieler.

Similar presentations


Presentation on theme: "Straight line drawings of planar graphs – part I Roeland Luitwieler."— Presentation transcript:

1 Straight line drawings of planar graphs – part I Roeland Luitwieler

2 Outline Introduction The shift method –The canonical ordering –The shift algorithm Next time: the realizer method

3 Introduction 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

4 Introduction Assumptions (can be taken care of in linear time) –n ≥ 3 (trivial otherwise) –Graph is maximal planar (=triangulated) –Graph has a topological embedding Terminology –Given an ordering on the vertices of graph G: G k is the induced subgraph of vertices v 1, …, v k –C o (G) is the outer cycle of a 2-connected graph G –Given a cycle C with u and v on it, but (u,v) not on it: The edge (u,v) is a chord of C

5 The canonical ordering An ordering of vertices v 1, …, v n is canonical if for each index k, 3 ≤ k ≤ n: 1. G k is 2-connected and internally triangulated 2. (v 1, v 2 ) is on C o (G k ) 3. If k+1≤n, v k+1 is in the exterior face of G k and its neighbours in G k appear on C o (G k ) consecutively

6 The canonical ordering Lemma: every triangulated plane graph has a canonical ordering Trivial for n=3, so assume n≥4 Proof by reverse induction –Base case (k=n): conditions hold since G n = G C o (G n ) consists of v 1, v 2 and v n –We now assume that v n, v n-1,..., v k+1 for k+1≥4 have been appropriately chosen and that the conditions hold for k –To prove: the conditions hold for k–1

7 The canonical ordering –If we can find a vertex (= v k ) on C o (G k ) which is not an end of a chord, the conditions hold Follows from G k–1 = G k – v k –Such a vertex always exists, because a chord always skips at least one vertex on the cycle

8 The canonical ordering A canonical ordering of a triangulated plane graph can be found in linear time –Use labels for vertices Label -1 means not yet visited Label 0 means visited once Label i means visited more than once and there are i intervals of visited neighbours in the circular order around the vertex –Algorithm: Let v 1 and v 2 be two consecutive vertices on C o (G) in counter clockwise order Label all other vertices -1 Process v 1 Process v 2 for k = 3 to n do – Chose a vertex v with label 1 – v k = v – Process v k

9 The canonical ordering –(Sub-algorithm) Process v: For all neighbours w of v not yet processed do –If label -1 then label(w) = 0 –If label 0 then (w has one processed neighbour u) »If w next to u in circular order of neighbours of v then label(w) = 1 »Otherwise label(w) = 2 –Otherwise (label i) »If vertices next to w in circular order of neighbours of v both have been processed then label(w) = i–1 »If neither has been processed yet then label(w) = i+1 –Correctness All processed vertices form G k and the chosen vertex is v k+1 –Verify the conditions hold now Successful termination guaranteed by previous proof

10 The shift algorithm General idea: –Insert vertices in canonical order in drawing –Invariants when inserting v k : 1.x(v 1 ) = 0, y(v 1 ) = 0, x(v 2 ) = 2k–6, y(v 2 ) = 0 2.x(w 1 ) < … < x(w t ) where C o (G k–1 ) = w 1, …, w t with w 1 = v 1, w t = v 2 3.Each edge on C o (G k–1 ) except (v 1, v 2 ) is drawn by a straight line having slope +1 or –1

11 The shift algorithm General idea: –Some vertices need to be shifted when inserting v k

12 The shift algorithm To obtain a linear time algorithm, x-offsets are used in stead of x-coordinates We use a binary tree to represent shift dependencies –Each node shifts whenever its parent shifts –Store x-offset and y-coordinate in each node Using the tree, the x-offsets can be accumulated in linear time

13 The shift algorithm Compute x-offsets and y-coordinates: –Compute values and create the tree for G 3 –For k = 4 to n do Let w 1, …, w t = C o (G k–1 ) with w 1 = v 1, w t = v 2 Let w p, w p+1, …, w q be the neighbours of v k on C o (G k–1 ) Increase Δx(w p+1 ) and Δx(w q ) by one Compute Δx(v k ) and y(v k ) Update the tree accordingly

14 The shift algorithm Updating the tree

15 The shift algorithm Computing Δx(v k ) and y(v k ) –Δx(w p, w q ) = Δx(w p+1 ) +... + Δx(w q ) –Δx(v k ) = ½ {Δx(w p, w q ) + y(w q ) – y(w p )} –y(v k ) = ½ {Δx(w p, w q ) + y(w q ) + y(w p )} –Other necessary updates: Δx(w q ) = Δx(w p, w q ) – Δx(v k ) If p+1 <> q then Δx(w p+1 ) = Δx(w p+1 ) – Δx(v k )

16 Conclusions The shift method uses –The canonical ordering –A 2n–4 x n–2 grid, obviously –Linear time Next time: the realizer method Questions?

17 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. D. Harel and M. Sardas, An Algorithm for Straight-Line Drawing of Planar Graphs, Algorithmica 20, 1998, pp. 119–135. 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.


Download ppt "Straight line drawings of planar graphs – part I Roeland Luitwieler."

Similar presentations


Ads by Google