Download presentation
Presentation is loading. Please wait.
Published byDustin Andrews Modified over 9 years ago
1
1 PQ Trees, PC Trees, and Planar Graphs Hsu & McConnell Presented by Roi Barkan
2
2 Outline Planar Graphs Definition Some thoughts Basic Strategy PC Tree Algorithm Review of PC Trees The Algorithm Complexity Analysis
3
3 Planar Graphs Graphs that can be drawn on a plane, without intersecting edges. Examples: Borders Between Countries Trees, Forests Simple Cycles Counter-Examples: K5K5 K 3,3
4
4 Basic Non-Planar Graphs
5
5 Some Thoughts Every Non-Planar Has a K 5 or K 3,3 Subgraph (Kuratowski, 1930) Articulation Vertices – Divide and Conquer. The Problem – Cycles Everything else is either inside or outside. Cut-Set Cycle in a Graph– A cycle that breaks the graph’s connectivity.
6
6 More Thoughts Small Variations on Trees are allowed Connect one vertex to another. Connect all leaves to the root. “Minimal” Biconnected Tree Biconnected: No Articulation Vertices Root Must Have a Single Child. Connect Root to a Descendant of its Child. Connect All Leaves to Ancestors.
7
7 Existing Solutions Hopcroft & Tarjan – 1974 First Linear Time Solution PQ-Tree related solutions Early 90’s Fairly complicated PC-Tree Solution – 1999 Presented here
8
8 Our Strategy Find a Cut-Set Cycle Replace it With a Simple Place-Holder Recursively Work on the Inside and the Outside of the Graph Put Everything Back Together On Error – Find a Kuratowski Sub- Graph.
9
9 Some Preprocessing Split by Articulation Vertices DFS Scan the Graph Reminder: Back-Edges connect vertices with their ancestors. Label the Vertices According to a Post- Order Traversal of the DFS-Tree Keep a List of Back-Vertices, Sorted in Ascending (Post-)Order
10
10 Data Representation Same building blocks as in PC-Trees. P-nodes represent regular vertices in the graph (store their label) C-nodes represent “place-holders” for cycles Very intuitive: reserves cyclic order of edges. Each P-node Knows its DFS-Parent, Each Tree-Edge Knows Who’s the Parent
11
11 Flow of The Algorithm On each step we will work on a single back-vertex, according to their order in the list. Recursion Ends when the list only holds the root. The root has to be a back-vertex When it’s the only back-vertex we know how to embed the graph
12
12 Finding a Cut-Set Cycle Let i be the current back-vertex. r is i’s son on the path to the back edge. Let T r be the DFS-subtree who’s root is r. We will view T r as a PC-tree No internal back edges (i is minimal) Back edges to i will be considered full Back edges to ancestors of i will be considered empty
13
13 Full-Partial Labeling X is a Full Vertex When (deg(x)-1) of its Neighbors are Full X is an Empty Vertex When (deg(x)-1) of its Neighbors are Empty X is Partial if it is not Full and not Empty A Terminal Edge Connects Partial Vertices. Algorithm: Start with Full Leaves, and Scan Up the PC-Graph
14
14 Terminal Path All Terminal Edges Are Connected Claim: If they do not form a Path The Graph isn’t Planar. (Proved Later) Claim: If we can’t Flip Full and Empty Vertices to Opposite side of the Path The Graph isn’t Planar. (Proved Later)
15
15 T r As a PC-Tree
16
16 The Actual Cut-Set Cycle
17
17 Pitfall A Vertex can have a degree of 2. It can Full and Empty Ambiguous. Easily detected: X’s Full Neighbor is the Only One Left on the Update List. Deg(X) = 2 In That Case – Only X is a Terminal Node.
18
18 Complete Labeling Algorithm L List of Full Leaves While L is not Empty X = pop(L) If L is Empty, and X has a neighbor of degree 2 output X as the Only Terminal Node. For each Neighbor Y of X Increment Y’s counter. If the counter reached deg(Y)-1 Add Y to L.
19
19 Finding The Terminal Path Climb Up the DFS Tree From All Partial Vertices, in an Interlaced Manner. Trim a Possible Apex. If We End Up with a Path Output it. If We End Up with a Tree Non- Planar.
20
20 Our Strategy - Reminder Find a Cut-Set Cycle Replace it With a Simple Place-Holder Recursively Work on the Inside and the Outside of the Graph Put Everything Back Together On Error – Find a Kuratowski Sub- Graph.
21
21 Place-Holder For A Cycle
22
22 Fine Details Resulting Graph has the Same Number of Edges, But One Less Cycle. A Vertex of Degree 2 on the Cycle Becomes an Articulation Vertex Avoid it by Contracting The Vertex. We Want to Avoid Having Neighboring C Nodes Contract them as well
23
23 Fine Details (2) Parent-bits of the edges need to be kept consistent. Actually not very hard. The new C-node is a Child of i. Vertices in the terminal path that lost their parents are “adopted” by the new C-node Edge contraction is easy to fix.
24
24 How It Is Done
25
25 How It Is Done (2)
26
26 How It Is Done (3)
27
27 Another Example
28
28 Another Example (2)
29
29 Another Example (3)
30
30 Another Example (4)
31
31 Our Strategy - Reminder Find a Cut-Set Cycle Replace it With a Simple Place-Holder Recursively Work on the Inside and the Outside of the Graph Put Everything Back Together On Error – Find a Kuratowski Sub- Graph.
32
32 Recursive Work The Inner Side of the Cycle is Easy A tree (T r ) where all the leaves, and the root are connected to a single node – i. The Outer Side is Done Recursively The new graph has fewer back-edges, and thus is simpler.
33
33 Putting It Together Each Phase Remembers: Contracted Edges The C-node it created Connecting Inner and Outer Parts is Easy The C-node preserves cyclic order.
34
34 Handling Errors Two Possible Cases: Terminal edges form a tree. Terminal path can’t be flipped correctly. Basic Idea Walk from i down the tree to problematic leaves Move up through back edges Down the tree back to i K 5 or K 3,3
35
35 Terminal Edges Form a Tree
36
36 Points to Remember Full Leaves have Back-Edges to i. Empty Leaves have Back-Edges to ancestors of i. Every C-node in the Graph originated from a cycle Every path through a C-node, represents two paths in the original graph.
37
37 Paths Through C-Nodes
38
38 When W is a P-Node
39
39 When W is a C-Node (1)
40
40 When W is a C-Node (2)
41
41 When W is a C-Node (2.1)
42
42 When W is a C-Node (2.2)
43
43 A Path that won’t Flip The Problematic Node is a C-Node Has an Empty and a Full Sub-Tree on the Same Side of the Path Terminal Edges Lead to Empty/Full Sub-Trees As Well
44
44 A Path That Won’t Flip (2)
45
45 Complexity Analysis Preprocessing DFS Scan Post-order scan of the DFS tree Actual Processing Finding Terminal Path Splitting Graph, Putting Back Together Ordering Internal Sub-Tree Recursive Call
46
46 Complexity Analysis (2) Preprocessing – Linear Finding Terminal Path Every Node scanned not on the Terminal Path will be removed from the graph. Only need to worry about total lengths of terminal paths Splitting and Joining O(Terminal Path) Sub-Trees Once for each node.
47
47 How Long Are The Paths Vertex is on the Terminal Path Only two are at the edges Linear cost Others lose at least one edge (to full subtree) O(|E|) total amount
48
48 Some Minor Details Terminal Path Flipping is Easy P-nodes sorted through the labeling process Flipping done in O(1) due to cyclic lists. Terminal Path Splitting is Easy Simply use some pointer tricks
49
49 Summary Intuitive, Linear Algorithm to a Non- Trivial Problem Data Structure Actually Represents the Problem Domain A Great Way to End A Great Seminar
50
50 Questions ?
51
51 Complexity Analysis Use Amortized Complexity If we work hard in phase i, we make the job easier for the next phases. Potential Function: |G i | – Number of Vertices and Edges in G i |C i | - Number of C-Nodes in G i |P i | - Number of P-Nodes in G i
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.