Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 9 (Layered drawings of digraphs) By: Waldo & Ludo uv.

Similar presentations


Presentation on theme: "Chapter 9 (Layered drawings of digraphs) By: Waldo & Ludo uv."— Presentation transcript:

1 Chapter 9 (Layered drawings of digraphs) By: Waldo & Ludo uv

2 Chapter 9 (Graphically) 1.The hierarchical approach: Cyclic aCyclic Layered drawing of G DiGraph G Cycle Removal (9.4) Layer assignment Crossing reduction X coordinate assignment (9.1) (9.2) (9.3) Waldo Ludo Waldo Handled by :

3 Important requirements of layering: 1.The layered digraph should be compact. 2.The layering should be proper. 3.The number of dummy vertices should be small

4 The layering algorithm: 1.No labels are set 2.Assign labels (integer), such that s < v < t 3.Assign vertices to a layer, such that layer of t <= v <= s

5 selecting vertices to label 1.When choosing a vertex v all preceding vertices u (u,v) should be labeled and minimized. Minimization is accomplished by looking at the most significant labels. Example {6} < {3,7}; {1,2,9} < {2,3,9}; etc. For more on this definition see page 274 of the book

6 Phase one (assign labels) 3 1 4 2 13 12 10 85 11 9 76

7 selecting vertices to add to a layer 1.When choosing a vertex u all vertices v (u,v) should be placed in a layer lower than u.

8 Phase two (assign layers) 13 12 10 11 9 8 5 3 1 7 4 2 6 13 12 10 85 3 1 11 9 7 4 2 6

9 Input: Reduced digraph G=(V,E) and a positive integer W Output: Layering of G of width at most W Algorithm (Coffman-Graham layering) Initially, all vertices are unlabeled (trivial, as we’ve seen) For (i = 1 to |V|) perform a. Choose an unlabeled vertex v, such that {lbl(u) : (u,v) element of E } is minimized b. Lbl(v) = i K=1; L1=null; U=null. While U != V loop a. Choose u element of (V-U), such that every vertex in {v : (u,v) element of E} is in U, and lbl(u) is maximized b. If not |Lk| < W and for every edge (u,w), w is element of preceding levels then k++; add u to Lk c. Add u to U.

10 Phase two (adjusted) 13 12 10 11 9 5 8 3 1 7 4 2 6 13 12 10 85 3 1 11 9 7 4 2 6

11 Algorithm (Coffman-Graham layering) adjusted 1)Exercise.. (only for phase two – previous slide) A. Describe the adjusted algorithm B. Draw the iterational steps of the adjusted algorithm one by one.

12 Crossing Reduction Input: proper layered digraph Layer-by-Layer Sweep Two-Layer Crossing Problem

13 Each vertex in the two layers gets a unique x-coordinate, purely for ordering purposes: Two-Layer Crossing Problem

14

15 uv Crossing Numbers

16 uv

17 pur q pqur p0211 q5063 u6906 r2320

18 pur q pqur p0211 q5063 u6906 r2320

19 pur q pqur p0211 q5063 u6906 r2320

20 pur q pqur p0211 q5063 u6906 r2320

21 pur q pqur p0211 q5063 u6906 r2320

22 Algorithms for minimizing Adjacent Exchange  Similar to Bubble-sort Split  Similar to Quick-sort Barycenter Method Median Method Quadratic time Linear time

23 Adjacent-Exchange uv

24 uv

25 uv

26 uv

27 Split ap

28 ap

29 pb

30 pb

31 p

32 apb

33 u 431625 Barycenter Method 7 If same barycenter: seperate arbitrarily by small amount

34 u 431625 Median Method 7 X-coordinate of u is the median of its neighbours If no neighbours, then med(u) = 0 Special case, if med(u) = med(v)...odd degree left, even right Median ???

35 431625 Not always optimal 7 Barycenter 4316257 Median 89 10

36 Bends occur at dummy vertices Objective is to: – Reduce angles of bends (minimal width) – Keep ordering of crossing reduction step Horizontal Coordinate Assignment

37 4 3 1 6 2 5 0123456X 2 3

38 Cycle Removal 1 23 654 789 1 2 3 4 5 6 7 8 9 Vertex sequence for G : Dashed edges are the leftward edges Leftward edges form feedback set R Reversing R makes G acyclic

39 Cycle Removal Problem: – Minimizing leftward edges / feedback set R How? – Greedy Cycle Removal Algorithm

40 Cycle Removal 1 23 654 789 Iterate: prepend sinks to S r and remove them from G

41 Cycle Removal 1 23 654 78 Iterate: prepend sinks to S r and remove them from G

42 Cycle Removal 1 23 654 78 Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G

43 Cycle Removal 23 654 78 Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G

44 Cycle Removal 3 654 78 Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G

45 Cycle Removal 654 78 Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G

46 Cycle Removal 54 78 Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G

47 Cycle Removal 54 78 Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G Choose vertex u such the outdegree(u) – indegree(u) is max, append to S l and remove from G

48 Cycle Removal Iterate: prepend sinks to S r and remove them from G Iterate: append sources to S l and remove them from G Choose vertex u such the outdegree(u) – indegree(u) is max, append to S l and remove from G Concatenate S l and S r to obtain S

49 Cycle Removal 1 2 3 6 4 5 7 8 9 1 23 654 789

50 1 2 3 6 4 5 7 8 9 1 23 654 789

51 Chapter 9 (in a nutshell) The hierarchical approach: Layer assignment Crossing reduction Horizontal coordinate assignment

52 Exercise 1)Prove Theorem 9.1 (Exercise 3 in book)


Download ppt "Chapter 9 (Layered drawings of digraphs) By: Waldo & Ludo uv."

Similar presentations


Ads by Google