Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?

Similar presentations


Presentation on theme: "Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?"— Presentation transcript:

1 Chapter 4: Straight Line Drawing Ronald Kieft

2 Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?

3 Introduction Straight Line Drawing deals with plane graphs Plane graph: can be drawn without edge crossings, given a fixed embedding However, the edges can be curved It was proved that every plane graph G has a straight line drawing Which can be found in polynomial time But the area of the drawing was not bounded Impractical

4 Introduction cont’d In 1990 two methods were found which did have a bound on the area Fraysseix: area is a grid of (2n - 4) x (n – 2) Scnhyder: area is a grid of (n – 2) x (n – 2) Both method have O(n) implementations Question: what is the minimum size of a grid required for a Straight Line Drawing? Probably ceil(2n / 3) x ceil(2n / 3) Has not yet been proven

5 Algorithm 1: Shift Method The method by Fraysseix is called the “Shift Method” Finds a Straight Line Drawing for every plane graph G with n ≥ 3 Area is bouned by a grid of size (2n – 4) x (n – 2) Shift Method can be divided into two steps: Step 1: Construct a Canonical Ordering Step 2: Insert vertices one by one, according to the Canonical Ordering (and make sure the graph stays a Straight Line Drawing)

6 Algorithm 1: Shift Method Step 1: Construct a Canonical Ordering What is a Canonical Ordering? Cycle: path through G which starts and ends at the same vertex Chord: an edge between two non-consecutive vertices on a Cycle Outer Cycle; C o (G): the boundary of the outer face π(v 1, v 2,…, v n ): ordering of all vertices of G G k : a subgraph of G formed by the first k vertices of ordering π

7 Algorithm 1: Shift Method Examples of all definitions:

8 Algorithm 1: Shift Method The ordering π is a Canonical Ordering if for every k, 3 ≤ k ≤ n: 1. G k is 2-connected and internally triangulated 2. (v 1, v 2 ) is an outer edge of G k 3. If k + 1 ≤ n, then vertex v k+1 is located in the outer face of G k and all neighbors of v k+1 in G k appear on C o (G)

9 Algorithm 1: Shift Method Example Canonical Ordering:

10 Algorithm 1: Shift Method Proof: every triangulated plane graph G has a Canonical Ordering Proof with induction on the number of vertices Two base cases: n = 3 and n = n Induction step: Start with n =n Then there exists a vertex w (w ≠ v 1, v 2 ) on the cycle C o (G k ) and w is not end of a chord on C o (G k ) Then G k-1 is G k without vertex w

11 Algorithm 1: Shift Method Conclusion: it is enough to show that there always is such a vertex w Take C o (G k ) = w 1, w 2,…, w t (with w 1 = v 1 and w t = v 2 ) Then two cases: C o (G k ) has no chords  any vertex of w 2, w 3,…, w t is such a vertex w C o (G k ) has one or more chords: Then C o (G k ) has a minimal chord (w p, w q ) such that the vertices w p+1, w p+2,…, w q-1 are not end of a chord Then any of the vertices w p+1, w p+2,…, w q-1 are such a vertex w

12 Algorithm 1: Shift Method Illustration of the proof:

13 Algorithm 1: Shift Method Step 2: Construct Straight Line Drawing using the Canonical Ordering L(v i ): set of vertices which need to be moved when vertex v i changes position μ(P 1, P 2 ): new gridpoint defined by a line +1 through P 1 and a line -1 through P 2 Manhattan distance between P 1 and P 2 should be even Example:

14 Algorithm 1: Shift Method G 3 is drawn in a standard way: Furthermore assume the following holds for G k-1 with k-1 ≥ 3: 1. P(v 1 ) = (0, 0) and P(v 2 ) = (2k – 6, 0) 2. The x-coordinates are increasing for the vertices on C o (G k ) 3. Each edge (w i, w i+1 ) on C o (G k ) is drawn by a straight line with slope +1 or -1

15 Algorithm 1: Shift Method Then vertex v k can be inserted into G k-1 as follows: Let w p, w p+1,…, w q be the neighbors of v k on C o (G k ) Vertex v k covers vertices w p+1, w p+2,…, w q-1 If vertex v k is inserted at μ(w p, w q ), then the edge (v k, w p ) might overlap with edge (w p, w p+1 ) Therefore all vertices w 1, w 2,…, w p are shifted to the left by one Same thing holds for the edge (v k, w q ) and therefore all vertices w q, w q+1,…, w t are shifted to the right by one After both shifts a correction is made to ensure that v 1 stays located at (0, 0) Because of the shifts, vertex v k can see all vertices w p, w p+1,…, w q Therefore all egdes starting at v k can be drawn as straight lines, without edges crossings

16 Algorithm 1: Shift Method

17 When all vertices are inserted, it holds that: P(v 1 ) = (0, 0) P(v 2 ) = (2n – 4, 0) P(v n ) = (n – 2, n – 2) Thus the final Straight Line Drawing has a grid of size (2n – 4) x (n – 2) The algorithm can be implemented in O(n) time

18 Algorithm 1: Shift Method Example Straight Line Drawing:

19 Algorithm 2: Realizer Method The method by Schnyder is called the “Realizer Method” Finds a Straight Line Drawing for every plane graph G Area is bounded by (n – 2) x (n – 2) The Realizer Method can be divided into four steps: Step 1: Proof a Barycentric Representation gives a Straight Line Drawing Step 2: Make a Schnyder Labeling of G Step 3: Make a Realizer for G Step 4: Proof that a Realizer can be seen as a Weak Barycentric Representation

20 Algorithm 2: Realizer Method Step 1: Barycentric Representation gives a Straight Line Drawing What is a Barycentric Representation? An injective function which assigns three values v 1, v 2 and v 3 to each vertex v, such that: v 1 + v 2 + v 3 = 1 For each edge (x, y) and each vertex z ≠ x, y there is some index k (with k = 1, 2 or 3) such that v k from x and y < v k from z

21 Algorithm 2: Realizer Method Proof: Barycentric Representation gives a Straight Line Drawing on the plane spanned by (1,0,0), (0,1,0) and (0,0,1) Follows from the definition that each vertex is mapped onto this plane What is left: prove that edges do not intersect

22 Algorithm 2: Realizer Method Proof: Two edges (x, y) and (u, v) do not intersect: From the definition of the barycentric representation: u i, v i < x i and u j, v j < y j x k, y k < u k and x l, y l < v l Solving these equations gives: i = j or k = l Assume i = j = 1 (since i, j, k, l = 1, 2, 3) Then u 1, v 1 < x 1 and u 1, v 1 < y 1 which says that the x- coordinate of both vertex u and v < the x-coordinate of both vertex x and y This implies that the edges (x, y) and (u, v) are separated by a line through (0,1,0)(0,0,1) This implies that the edges (x, y) and (u, v) do not intersect

23 Algorithm 2: Realizer Method Thus Barycentric Representation gives a Straight Line Drawing Grid size is (2n – 5) x (2n – 5) Using a Weak Barycentric Representation, the grid size can shrink to (n – 2) x (n - 2) A Weak Barycentric Representation is again an injective function assigning three values, such that: v 1 + v 2 + v 3 = 1 For each edge (x, y) and each vertex z ≠ x, y there is some index k (with k = 1, 2 or 3) such that (v k, v k+1 ) from x and y < lex (v k, v k+1 ) from z Where (a, b) < lex (c, d) is true if a < c or when a = c and b < d Proof: Weak Barycentric Representation gives a Straight Line Drawing Same idea as proof for normal Barycentric Representation

24 Algorithm 2: Realizer Method Step 2: Make a Schnyder Labeling What is a Schnyder Labeling? An assignment of a label 1, 2 or 3 to all angles of inner facial triangles, such that: Each inner facial triangle has an angle labeled 1, another one labeled 2 and another one labeled 3, in a counter-clockwise order The labels of the angles at each inner vertex of G form, in counter-clockwise order, a nonempty interval of 1’s, a nonempty interval of 2’s and a nonempty interval of 3’s

25 Algorithm 2: Realizer Method Proof: every triangulated plane graph G has a Schnyder Labeling N(x): the set of neighbors of x in G G/(x,y): the graph obtained by contracting edge (x,y) from G (that is, remove y from G and connect al neighbors from y to x) Contractible(x, y): whether or not edge (x, y) is contractible. An edge (x, y) is only contractible if N(x) and N(y) share two vertices Separating Triangle: a triangle in G which has both interior and exterior vertices An edge (x, y) is contractible if there is no separating triangle containing (x, y), otherwise the resulting graph will no longer be triangulated

26 Algorithm 2: Realizer Method Edge contraction examples:

27 Algorithm 2: Realizer Method To prove that every graph G has a Schnyder Labeling, first prove that G has a outer vertex a, which has a neighbor x, such that edge (a, x) is contractible Proof by induction on the number of vertices Base case: 4 vertices, K 4  inner vertex as x Induction Step: two cases: G has no separating triangles containing a  edge (a, x) is contractible for any neighbor x of a G has a separating triangle T containing a  by induction the subgraph inside T has a vertex x such that (a, x) is contractible

28 Algorithm 2: Realizer Method Proof: every graph G has a Schnyder Labeling: This is trivial for n = 3 For n ≥ 4, then there exists an inner vertex x adjacent to outer vertex a, such that edge (a, x) is contractible (previous proof) Contracting this edge gives a graph which has one node less and (by induction) has a Schnyder Labeling Take this Schnyder Labeling and perform a reverse edge contraction (that is, adding a vertex), then the Schnyder Labeling can extended to a Schnyder Labeling of graph G The order in which the vertices are added is given by the expansion sequence Canonical Ordering is an expansion sequence

29 Algorithm 2: Realizer Method The way in which the Schnyder Labeling is adjusted:

30 Algorithm 2: Realizer Method Orientation of an edge: Each edge has two distinct labels at one end and two identical labels at the other end Follows from the conditions of the Schnyder Labeling The side with the two identical labels is called the “label of the edge” The edge is oriented in the direction of the “label of the edge”

31 Algorithm 2: Realizer Method Proof: the angles at one outer vertex have all label 1, all label 2 for another and all label 3 for the last outer vertex G is triangulated  (n – 3) inner vertices and (3n – 9) inner edges Each inner vertex has three outgoing edges (condition 2 Schnyder Labeling) Together: 3(n – 3) outgoing edges for all inner vertices Thus: no outgoing edges leaves a outer vertex, so all edges incident on a outer vertex are incoming Thus: the angles at outer vertices all have the same label (definition of the orientation of an edge)

32 Algorithm 2: Realizer Method Step 3: Make a Realizer for G What is a Realizer? A Realizer of a triangulated graph G is a partition of the inner edges into three sets T 1, T 2 and T 3, such that for each inner vertex v: v has an outgoing edge in each of T 1, T 2 and T 3 The counter-clockwise order of the edges incident on v is: Leaving in T 1 Entering in T 3 Leaving in T 2 Entering in T 1 Leaving in T 3 Entering in T 2

33 Algorithm 2: Realizer Method Realizer definitions: Root r i : the outer vertex of T i P i (v): the path in T i from vertex v to the root r i of T i Since P i (v) and P j (v) for i ≠ j share only vertex v, the path P 1 (v), P 2 (v) and P 3 (v) divide the graph into three regions R 1 (v), R 2 (v) and R 3 (v) R i (v): the closed region opposite to root r i of T i

34 Algorithm 2: Realizer Method Proof: Realizer is a Weak Barycentric Representation P i (v): the number of vertices in path P i (v) R i (v): the number of vertices in region R i (v), which includes both roots and vertices on both paths n i (v): all vertices in region R i (v) which are not on the path P i-1 (v) Then n 1 (v) + n 2 (v) + n 3 (v) = n – 1, since vertex v is in all regions, but also on all path and is therefore never counted

35 Algorithm 2: Realizer Method Take function f, which for every vertex v gives: 1 / (n – 1) (n 1 (v), n 2 (v), n 3 (v)) Satisfies condition 1, since n 1 (v) + n 2 (v) + n 3 (v) = n – 1 Also satisfies condition 2 A lot of math and definitions This part of the proof is omitted Conclusion: Weak Barycentric Representation  Straight Line Drawing on a (n – 2) x (n – 2) grid Schnyder Labeling gives a Realizer Realizer is a Weak Barycentric Representation All together: Realizer Method gives a Straight Line Drawing on a (n – 2) x (n – 2) grid

36 Algorithm 2: Realizer Method Example Straight Line Drawing:

37 Other parts of chapter 4 Special types of graphs can be drawn on smaller grid (than those by the previous two methodes) 4-connected graph: grid of ((n / 2) – 1) x (n / 2) Algorithm of Miura Idea: Use a 4-Canonical Ordering to split the graph G into two pieces Draw both pieces inside a triangle Connect both triangles

38 Questions?


Download ppt "Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?"

Similar presentations


Ads by Google