PQ Trees, PC Trees, and Planar Graphs - PowerPoint PPT Presentation

About This Presentation
Title:

PQ Trees, PC Trees, and Planar Graphs

Description:

Every Non-Planar Has a K5 or K3,3 Subgraph (Kuratowski, 1930) ... Simply use some pointer tricks. 49. Summary. Intuitive, Linear Algorithm to a Non-Trivial Problem ... – PowerPoint PPT presentation

Number of Views:130
Avg rating:3.0/5.0
Slides: 52
Provided by: Bar145
Category:
Tags: graphs | math | planar | trees | tricks

less

Transcript and Presenter's Notes

Title: PQ Trees, PC Trees, and Planar Graphs


1
PQ Trees, PC Trees, and Planar Graphs
  • Hsu McConnell
  • Presented by Roi Barkan

2
Outline
  • Planar Graphs
  • Definition
  • Some thoughts
  • Basic Strategy
  • PC Tree Algorithm
  • Review of PC Trees
  • The Algorithm
  • Complexity Analysis

3
Planar Graphs
  • Graphs that can be drawn on a plane, without
    intersecting edges.
  • Examples
  • Borders Between Countries
  • Trees, Forests
  • Simple Cycles
  • Counter-Examples
  • K5
  • K3,3

4
Basic Non-Planar Graphs
5
Some Thoughts
  • Every Non-Planar Has a K5 or K3,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
    graphs connectivity.

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
Existing Solutions
  • Hopcroft Tarjan 1974
  • First Linear Time Solution
  • PQ-Tree related solutions
  • Early 90s
  • Fairly complicated
  • PC-Tree Solution 1999
  • Presented here

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
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
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 Whos the Parent

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 its the only back-vertex we know how to
    embed the graph

12
Finding a Cut-Set Cycle
  • Let i be the current back-vertex.
  • r is is son on the path to the back edge.
  • Let Tr be the DFS-subtree whos root is r.
  • We will view Tr 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
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
Terminal Path
  • All Terminal Edges Are Connected
  • Claim If they do not form a Path ? The Graph
    isnt Planar. (Proved Later)
  • Claim If we cant Flip Full and Empty Vertices
    to Opposite side of the Path ? The Graph isnt
    Planar. (Proved Later)

15
Tr As a PC-Tree
16
The Actual Cut-Set Cycle
17
Pitfall
  • A Vertex can have a degree of 2.
  • It can Full and Empty ? Ambiguous.
  • Easily detected
  • Xs Full Neighbor is the Only One Left on the
    Update List.
  • Deg(X) 2
  • In That Case Only X is a Terminal Node.

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 Ys counter.
  • If the counter reached deg(Y)-1 ? Add Y to L.

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
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
Place-Holder For A Cycle
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
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
How It Is Done
25
How It Is Done (2)
26
How It Is Done (3)
27
Another Example
28
Another Example (2)
29
Another Example (3)
30
Another Example (4)
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
Recursive Work
  • The Inner Side of the Cycle is Easy
  • A tree (Tr) 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
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
Handling Errors
  • Two Possible Cases
  • Terminal edges form a tree.
  • Terminal path cant 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 ? K5 or K3,3

35
Terminal Edges Form a Tree
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
Paths Through C-Nodes
38
When W is a P-Node
39
When W is a C-Node (1)
40
When W is a C-Node (2)
41
When W is a C-Node (2.1)
42
When W is a C-Node (2.2)
43
A Path that wont 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
A Path That Wont Flip (2)
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
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
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
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
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
Questions ?
51
Complexity Analysis
  • Use Amortized Complexity
  • If we work hard in phase i, we make the job
    easier for the next phases.
  • Potential Function
  • Gi Number of Vertices and Edges in Gi
  • Ci - Number of C-Nodes in Gi
  • Pi - Number of P-Nodes in Gi
Write a Comment
User Comments (0)
About PowerShow.com