introduction to graph drawing
DESCRIPTION
Introduction to Graph 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. Data flow analysis. Scheduling. Electrical networks. Database logic algorithm. - PowerPoint PPT PresentationTRANSCRIPT
INTRODUCTION TO GRAPH 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.
DIVIDE AND CONQUERSERIES-PARALLEL DIGRAPHS
Scheduling
Electrical networks
Data flow analysis
Database logic algorithm
SERIES-PARALLEL DIGRAPHS
Directed graph with a source and sink nodes or poles.
source
sink
THE 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)
SERIES COMPOSITION OF DIGRAPHS
Identifying the sink of one and the source of the other as one vertex
source
source
source
sink sink
sink
PARALLEL COMPOSITION OF DIGRAPHS
Identifying as one vertex both their sources Identifying as one vertex both their sinks
source
sink
source
source
sink sink
DECOMPOSITION 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.
THE RECURSIVE DEFINITION OF DECOMPOSITION TREES
G is a single edge so T is a single Q-node
Q
DECOMPOSITION TREES
If G is a parallel composition of s-p digraphs: G1 and G2 , and T1 and T2 are their decomposition trees respectively, then T the decomposition tree of G has a root which is a P-node and two subtrees T1 and T2
P
T1 T2
DECOMPOSITION TREES
If G is a series composition of s-p digraph:G1 and G2 , the sink of G1 is identified with the source of G2 .And T1 and T2 are their decomposition trees respectively, then T the decomposition tree of G has a root which is a S-node and two subtrees T1 and T2
S
T1 T2
DECOMPOSITION 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
P
T1 T2S
P
T1
S
Q
Q Q
P
T1
S
Q
T2
P
PS
SQ
Q Q
S
SQ
Q Q
S
SQ
P
SQ
Q Q
S
SP
Q QSQ
Q Q
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
COMPONENTS
Let C be a maximal path of same node type on T
Let u1 … uk children of C not on C Component is the part of G associated with a
subsequence ui … uj where 1 ≤ i ≤ j ≤ k Component is closed when C is of S-nodes Otherwise it is open
CLOSED COMPONENTP
PS
SQ
Q Q
S
SQ
Q Q
S
SQ
P
SQ
Q Q
S
SP
Q QSQ
Q Q
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.
OPEN COMPONENT
NOT A CLOSED COMPONENT
LOOKING 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.
RIGHT-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
Δ-SP-DRAW
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
Δ-SP-DRAW – BASE
If G is a single edge Draw it as a vertical edge Bounding triangle Δ(Γ)
G
t
s
Δ-SP-DRAW – 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
PRESCRIBED-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
G2v
u
k
t
s
λv
λu
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 toupper and lower corners of Δ(Γ)
Δ-SP-DRAW – PARALLEL
G1
G2
t
s
12
3
P
S S
Q QSQ
Q Q
s’
t’
3
s”
t”
1
2
MOVING SOURCE AND SINK
s’
t’
3
s”
t”
1
2
t
s
12
3
INVARIANTS
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
LEMMA 3.3
Let u and v be neighbors of the sourceso (s, u) is left of (s, v)
Let λu and λv be rays of slope - /4from u and v
If invariant 3 holdsthen λu is below λv
s
u v
λu
λv
LEMMA 3.3 – OUTCOME
If G2 is placed to the right of G1 and above λuwhere (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 onG1 and G2 it is also held on G
Symmetrically invariant 4 can be proved
s
u
THEREFORE
Proving Invariants 3 and 4 guarantee thats and t can be moved as described in the algorithm without creating crossings.
Invariant 2 states that left cornerof Δ(Γ) is always empty,so G2’s left corner can beon the base of G1.
AREA 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(n2)
CALCULATING DISTANCES
We’ll describe Γ by:b = length of the baseb’ = vertical distance to λub” = vertical distance to λv v
u
κ
t
s
λv
λu
b’
b’’
b
PARALLEL DISTANCES
To describe parallel combinations we’ll use:Δx = horizontal distance from
Δ(Γ1) to Δ(Γ2)Δy = vertical distance from
bottom ray of Δ(Γ1) toleft corner of Δ(Γ2) Δx
Δy
Δ-SP-LABELinput : decomposition tree T of Goutput : labeling b, b’, b’’ for each subtree of Tif root = Q-node then
b(T) = b’(T) = b’’(T) = 2else
Δ-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 thenb(T) = b(T1) + b(T2)+2Δxif T2 is Q-node (transitive edge) thenb’(T) = b’’(T) = b(T)elseb’’(T) = b(T1) + 2Δx – Δy + b’’(T2)b’(T) = b’(T2) + Δy
Δ-SP-LABEL
Δx can be 0 Δy can be b’(T1) The area needed is O(n2) The algorithm runs in O(n)
and needs O(n) space
end of Series-Parallel Digraphs