Presentation is loading. Please wait.

Presentation is loading. Please wait.

I NTRODUCTION TO G RAPH DRAWING Fall 2010 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G. 1998 Graph Drawing: Algorithms for the Visualization.

Similar presentations


Presentation on theme: "I NTRODUCTION TO G RAPH DRAWING Fall 2010 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G. 1998 Graph Drawing: Algorithms for the Visualization."— Presentation transcript:

1 I NTRODUCTION TO G RAPH DRAWING Fall 2010 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G. 1998 Graph Drawing: Algorithms for the Visualization of Graphs. 1st. Prentice Hall PTR.

2 D IVIDE AND C ONQUER S ERIES -P ARALLEL D IGRAPHS Scheduling Electrical networks Data flow analysis Database logic algorithm

3 S ERIES -P ARALLEL D IGRAPHS Directed graph with a source and sink nodes or poles. source sink

4 T HE RECURSIVE DEFINITION OF S - P DIGRAPH An edge joining two vertices is a s-p digraph. (a) Let G’ and G” be two s-p digraphs these two compositions of them also are s-p digraphs: The series composition of G’ and G” is the digraph obtained identifying the sink of G’ with the source of G”. (b) The parallel composition of G’ and G” is the digraph obtained by identifying the source of G’ with the source of G” and the sink of G’ with the sink of G”. (c)

5 S ERIES COMPOSITION OF DIGRAPHS Identifying the sink of one and the source of the other as one vertex source sink

6 P ARALLEL COMPOSITION OF DIGRAPHS Identifying as one vertex both their sources Identifying as one vertex both their sinks source sink source sink

7 D ECOMPOSITION TREES A series-parallel digraphs is associated with a binary tree named decomposition tree or parse tree There are three different kinds of nodes in this tree: S-nodes, P-nodes and Q-nodes.

8 T HE RECURSIVE DEFINITION OF D ECOMPOSITION TREES G is a single edge so T is a single Q-node Q

9 D ECOMPOSITION TREES If G is a parallel composition of s-p digraphs: G 1 and G 2, and T 1 and T 2 are their decomposition trees respectively, then T the decomposition tree of G has a root which is a P-node and two subtrees T 1 and T 2 P T1T1 T2T2

10 D ECOMPOSITION TREES If G is a series composition of s-p digraph:G 1 and G 2, the sink of G 1 is identified with the source of G 2.And T 1 and T 2 are their decomposition trees respectively, then T the decomposition tree of G has a root which is a S-node and two subtrees T 1 and T 2 S T1T1 T2T2

11 D ECOMPOSITION TREES The leaves of T are Q-nodes The internal nodes are either S-nodes or P-nodes. If a node has the same type as its parent it will be the right child T is unique for G If G has n nodes then T has O( n ) leaves and O( n ) nodes. (graph G is simple) T can be created in O( n ) time so will be assumed to be part of the input

12 P T1 T2 S P T1 S Q Q Q P S Q T2

13 P P S SQ QQ S SQ QQ S S Q P SQ QQ S SP QQ SQ QQ The leaves of T are Q- nodes The internal nodes are either S-nodes or P-nodes. If a node has the same type as its parent it will be the right child T is unique for G

14 C OMPONENTS Let C be a maximal path of same node type on T Let u 1 … u k children of C not on C Component is the part of G associated with a subsequence u i … u j where 1 ≤ i ≤ j ≤ k Component is closed when C is of S-nodes Otherwise it is open

15 C LOSED COMPONENT P P S SQ QQ S SQ QQ S S Q P SQ QQ S SP QQ SQ QQ

16 E. Di Giacomo, Drawing series-parallel graphs on restricted integer 3D grids, in Proc. 11th International Symp. on Graph Drawing (GD ’03), vol. 2912 of Lecture Notes in Comput. Sci., Springer, 2004, pp. 238–246.

17 O PEN COMPONENT

18 N OT A CLOSED COMPONENT

19 L OOKING FOR A DRAWING FOR S - P DIGRAPH It has been proved that : there exist embedded s- p digraphs that any of their upward straight-line drawing that preserves embedding, requires exponential area. [ P.Bertolizza, R.F. Cohen, G.Di Battista, R. Tamassia and I.G. Tollis: “ How to Draw a Series-Parallel Digraph ”, Internat J.Comput. Geom. Appl., 4, 385-402, 1994. ] [ A. Garg and R. Tamassia,:” Efficient Computation of Planar Straight-Line Upward Drawing ”, In GD 93, (Proc. ALCOM Workshop on Graph Drawing.) 1993. ] To have a drawing with polynomial area it is necessary to change the given embedding.

20 R IGHT - PUSHED EMBEDDING The edge ( u,v ) in G is transitive if there is another path from u to v other than ( u,v ). Drawing transitive edge ( u, v ) on the right of all components with u and v poles

21 Δ-SP-D RAW Drawing inside a bounding triangle Δ(Γ) which is isosceles and right-angled. Series composition: one above the other Parallel – one to the right of the other base top side bottom side G1 G2 G1 G2

22

23 Δ-SP-D RAW – BASE If G is a single edge Draw it as a vertical edge Bounding triangle Δ(Γ) G t s

24 Δ-SP-D RAW – SERIES If G is a series composition of G1 and G2 Recursively draw Γ1 and Γ2 Translate Γ2 so G2’s sink is on G1’s source Extend bounding triangle Δ(Γ) accordingly G1 G2

25 P RESCRIBED - REGION (v, t) and (s, u) are rightmost edges on G1 λv and λu are rays parallel to G1’s bounding triangle G2 will be translated to anywhere on the right of λ v, λ u and k. G1 G2 v u k t s λvλv λuλu

26 If G is a parallel composition of G1 and G2 Recursively draw Γ1 and Γ2 Translate Γ2 to the “prescribed-region” of G2 (right of the dashes) Extend bounding triangle Δ(Γ) accordingly Move sources and sinks to upper and lower corners of Δ(Γ) Δ-SP-D RAW – PARALLEL G1 G2

27

28 t s 1 2 3 P S S QQ SQ QQ s’ t’ 3 s” t” 1 2

29 M OVING SOURCE AND SINK s’ t’ 3 s” t” 1 2 t s 1 2 3

30 I NVARIANTS The drawing is contained inside the right angled triangle. The source and sink are placed at the bottom and top corner of Δ(Γ) respectively. For any vertex u adjacent to the source s of G, the wedge formed at u by rays with slopes -/2 and -/4 does not contain any vertex of G except s. For any vertex v adjacent to the sink t of G, the wedge formed at v by rays with slopes /2 and /4 does not contain any vertex of G except t. t s u

31 L EMMA 3.3 Let u and v be neighbors of the source so ( s, u ) is left of ( s, v ) Let λ u and λ v be rays of slope - /4 from u and v If invariant 3 holds then λ u is below λ v s uv λuλu λvλv

32 L EMMA 3.3 – OUTCOME If G2 is placed to the right of G1 and above λu where (s, u) is the rightmost edge of s on G1 Then no vertex of G2 is in the wedge limited by the –/4 ray from the neighbors of s Hence if invariant 3 is held on G1 and G2 it is also held on G Symmetrically invariant 4 can be proved s u

33 T HEREFORE Proving Invariants 3 and 4 guarantee that s and t can be moved as described in the algorithm without creating crossings. Invariant 2 states that left corner of Δ(Γ) is always empty, so G2’s left corner can be on the base of G1.

34 A REA OF THE TRIANGLE So the base of resulting triangle is equals the sum of bases of both triangles. For a graph with n vertices the length of the base is 2n. So the area needed is O(n 2 )

35 C ALCULATING DISTANCES We’ll describe Γ by: b = length of the base b’ = vertical distance to λu b” = vertical distance to λv v u κ t s λvλv λuλu b’ b’’ b

36 P ARALLEL DISTANCES To describe parallel combinations we’ll use: Δx = horizontal distance from Δ(Γ1) to Δ(Γ2) Δy = vertical distance from bottom ray of Δ(Γ1) to left corner of Δ(Γ2) Δx Δy

37 Δ-SP- LABEL input : decomposition tree T of G output : labeling b, b’, b’’ for each subtree of T if root = Q-node then b(T) = b’(T) = b’’(T) = 2 else Δ-SP-label of T1 and T2 (the subtrees) if root = S-node then b(T) = b(T1) + b(T2) b’(T) = b(T1) b’’(T) = b(T2) else root = P-node then b(T) = b(T1) + b(T2)+2Δx if T2 is Q-node (transitive edge) then b’(T) = b’’(T) = b(T) else b’’(T) = b(T1) + 2Δx – Δy + b’’(T2) b’(T) = b’(T2) + Δy

38 Δ-SP- LABEL Δx can be 0 Δy can be b’(T1) The area needed is O(n 2 ) The algorithm runs in O(n) and needs O(n) space end of Series-Parallel Digraphs


Download ppt "I NTRODUCTION TO G RAPH DRAWING Fall 2010 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G. 1998 Graph Drawing: Algorithms for the Visualization."

Similar presentations


Ads by Google