INTRODUCTION TOGRAPH DRAWINGFall 2010
Battista G D Eades P Tamassia R and Tollis I G 1998 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G. 1998 Graph Drawing: Algorithms for the Visualization of Graphs. 1st. Prentice Hall PTR.
PLANARITY TESTING
PLANARITY TESTING
1. Count edges and check Euler's formulag2. Find pieces of G3. For each piece P that is not a path
test planarity by recursion4. Compute interlacement graph of the pieces5 T t if th i t l t h i bi tit5. Test if the interlacement graph is bipartite
PLANARITY TESTING
Graph is planar if and only if all its connected p p ycomponents are planarA connected graph is planar if and only if all its bi t d t lbiconnected components are planar
REVIEW
A graph is connected if there is a path between ug p pand v for each pair (u,v) of vertices A cutvertex in a graph is a vertex whose removal di t th hdisconnects the graph.A connected graph with no cutvertices is biconnected.biconnected.A maximal biconnected subgraph of a graph is biconnected component.
Decomposing the Graph into connected and p g pbiconnected components. Our problem will be restricted to testing the
l it f bi t d hplanarity of biconnected graphs.Use cycle to decompose a biconnected graph into pieces.pieces.
PIECE P OF A GRAPH G WITH RESPECT TOPATH C
The subgrap induced by the edges of path C in a g p y g pclass is called a piece of G with respect to C
v6v4
v7v2
v7v2v3
4 v9
v1v5
' ( ' ')G V Ev9
v1v5
v8
1
v2
' ( ', ')'' ( ' ')
G V EV VE E V V
=⊆⊆ ∩ ×
( , )G V E= v8
1 v7
v9
v2
' ( ', ')'' ( ' ')
G V EV VE E V V
=⊆= ∩ × v8
v1v5
PARTITIONING INTO PIECES
Let a biconnected graph G contain a cycle Cg p yPartition the edges of G not on C into classes:
Two edges of G are in the same class if there is a path b t th th t d t t i t f Cbetween them that dose not contain any vertex of C.
SUB GRAPH INDUCED BY EDGES IN A CLASS ISCALLED A PIECE OF G WITH RESPECT TO C.
Pieces consisting of a single edge between two Pieces consisting of a single edge between two vertices of CPieces consisting of a connected graph with at least one vertex not in C
ATTACHMENTS
Vertices of piece P which are also on cycle C are p ycalled attachments of P.Each piece has at least two attachments. (why?)
SEPARATING CYCLE
Cycle C is separating if it has at least two pieces.y p g pAnd it is nonseparating if it has one piece.
separatingnonseparating
LEMMA 3.4Let G be a biconnected graph and C be a g pnonseparating cycle of G with piece P. If P is not a path then G has a separating cycle C’ consisting of subpath of C and a path of Pof subpath of C and a path of P.
separatingnonseparating
LEMMA 3.4 PROOF
Let u and v be 2 attachments of P that areti i th i l d iconsecutive in the circular ordering.
Let γ be a subpath of C between u and vwithout any attachments.Si P i t d th i γ
π
Since P is connected there is apath π in P between u and v.Let C’ be the cycle obtained from Cby replacing γ with π C
γe
by replacing γ with π.Now γ is a piece on G with respect to C’Let e be an edge on P not π.e exist Because P is not a pathe exist Because P is not a path.So there is a piece of C’ otherthan γ which contains e.Thus C’ is a separating cycle in G
C’
Thus C is a separating cycle in G.
INTERLACEMENT
Each piece can be drawn either entirelyp yinside or outside of the cycleInterlacing pieces are ones that can’t be drawn on th id f C ith t ithe same side of C without crossing
Interlace
Not interlace
INTERLACEMENT GRAPH
Vertices are pieces on G with respect to cycle Cp p yEdges are pairs of pieces that interlace (can’t reside on the same side of C without crossing).
INTERLACEMENT TO PLANARITY
If G is planar graph then its interlacement graph p g p g pmust be bipartite
P3P1
P5P6
P2P4
P2
THEOREM 3.8A biconnected graph G with cycle C is planar g p y pif and only if:For each piece P of G with respect to C, the graph bt i d b ddi P t C i lobtained by adding P to C is planar
The interlacement graph of the pieces of G with respect to C, is bipartiterespect to C, is bipartite
PLANARITY TESTING
1. Count edges and check Euler's formulag2. Find pieces of G3. For each piece P that is not a path
test planarity by recursion4. Compute interlacement graph of the pieces5 T t if th i t l t h i bi tit5. Test if the interlacement graph is bipartite
ALGORITHM PLANARITY TESTING
Input a biconnected graph G with n vertices and at p g pmost 3n-6 edges, and a separating cycle C.
Output an indication of whether G is planar
1 C t th i f G ith t t C (O( ))1. Compute the pieces of G with respect to C. (O(n))
ALGORITHM PLANARITY TESTING
2. For each piece P of G that is not a path:p pLet P’ be the graph obtained by adding P to CLet C’ be the cycle of P’ obtained from C by replacing the portion of C between two consecutive attachments the portion of C between two consecutive attachments with a path P between themApply the algorithm recursively to graph P’ and cycle C’ If P’ i l t “ l ” (O( 2)) C’. If P’ is nonplanar, return “nonplanar”. (O(n2))
ALGORITHM PLANARITY TESTING
3. Compute the interlacement graph I of the p g ppieces. (O(n2))
ALGORITHM PLANARITY TESTING
4. Test whether I is bipartite. If I is not bipartite p preturn “nonplanar”. O(n2))
5. Return “planar”.
OVERALL RUNTIME
Each recursive invocation takes O(n2)( )Each recursion is associated with at least one edge of GThere are O(n) edgesRuntime is O(n3)