無投影片標題

S&H Planarity Test Based on
PC-Trees
Wen-Lian Hsu
Prior Results
• 1st approach
– Hopcroft and Tarjan [1974],first O(m) time.
– PATH ADDITION
• 2nd approach
–
–
–
–
Lempel, Even and Cederbaum[1967], O(n2) time
VERTEX ADDITION
st-numbering, consecutive ones testing
Booth and Lueker [1976] used PQ-trees to test the
consecutive ones property in O(m+n) time
• 3rd approach
– Shih and Hsu [1999] used PC-trees for recognition
and embedding.
– EDGE ADDITION
2/40
Advantages of S&H algorithm
• Start with a DFS-tree, everything else is very
elementary
• Recognition and Embedding are done at the
same time
• Whenever non-planarity is detected, a
forbidden Kuratowski’s subgraph can be
located.
• Provides a linear time algorithm for finding
maximal planar subgraphs
3/40
Our Approach -- Edge addition
Start with a Depth-First-Search Tree
(with post ordering)
16
15
13
4
14
7
2
10
3
1
12
11
5
6
8
9
4/40
PC-Tree: Keeping relations
between components and nodes
5/40
Transforming a 2-connected
component into a c-node
i
i
i
1
1
2
3
3
1
ik
2
3
2
6/40
Efficiency Note
• We might assume that the graph is originally
2-connected
– since otherwise DFS will separate the graph into
2-connected components and we can work on
each one individually
• This will force each leaf in the DFS-tree to
have at least one back edge to nodes  i
– However, this is not crucial
7/40
Adding the set of back edges
connecting to a new vertex
at each iteration
Work on each branch separately
8/40
Concentrate on one subtree at a time
Resulting in one component
i
Subtree
r
At the end of the iteration
i
Tr
9/40
What do we need to do at each
iteration?
• For each 2-connected component,
determine what should be embedded
inside and what should be outside
• We can do this by finding the boundary
path separating them
10/40
Boundary paths of the component
• Non-unique part
– Some part of the boundary path leading to
node i can have many candidates
– Focus on nodes that have to be embedded
outside
• Unique part
– However, all boundary paths will share a
unique subpath (the terminal path ) whose
two ends (terminal nodes) are connected
to nodes > i (through back edges)
11/40
An Important Observation
• A leaf with a back edge to i and no
other back edges must be inside
• A leaf whose back edges all point to
nodes > i must be outside
• A leaf with both a back edge to node i
and other back edges to nodes > i must
be on the boundary
12/40
Essential nodes
Nodes that must be on the boundary
• The labeling procedure
– Label all nodes that have back edges to i.
– If a node is labeled, label its parent.
• The 2-connected component
– All labeled nodes
– All traversed edges
– All back edges to I
• Essential node
– a labeled node with an un-labeled neighbor
13/40
Terminal path
• All essential nodes must lie on a tree
path
– Otherwise, one can immediately find
Kuratowski subgraphs
• A terminal path is the shortest path in
the PC-tree containing all essential
nodes
– The two ends of the path is called the
terminal nodes (which must be essential)
14/40
What if there are 3 essential nodes
that do not lie on a path?
• 3 such nodes must have a center in the
tree
– The center is different from any of these 3
nodes
– There are 3 node-disjoint paths from the
center to the 3 essential nodes
• The end essential nodes of these 3 paths are
called extreme essential nodes
15/40
The 3 extreme essential nodes (I)
Case 1. The 3 essential nodes are on the boundary of a C-node w
t
i
i3
t
i3
i
w
i1
i1
i2
i2
K5
16/40
The 3 extreme essential nodes (II)
Case 2. Otherwise
t
i
w
i
t
w
i1
i2
i3
K3,3
i1
i2
i3
17/40
Two cases of the terminal paths
• Case 1
• Case 2
– A terminal node lies
on the path between
root r and another
terminal node
r
– Otherwise
r
18/40
The terminal path
• A subtree is full (empty) if all nodes are
labeled (unlabeled)
• If the graph is planar, there is a terminal path
s. t. all full subtrees can be flipped to one side
and empty subtrees to another.
i
Full side
u
u'
Empty side
19/40
Correct Flipping of full subtrees and
empty subtrees w.r.t. the terminal path
• The argument is very similar to that of the 3 extreme
essential nodes’ case.
i
u
u'
20/40
A Necessary and Sufficient Condition
for a Graph to be Planar
• A graph is planar iff
at every iteration i, there exists a
terminal path
– nodes on this path can be flipped so that
all full subtrees lie on one side, and all
empty subtrees lie on the other side
without violating the cyclic order of any Cnode
21/40
At the end of the iteration (1)
i
Form
a 2-connected component
u
m
u'
22/40
Essential nodes on the boundary
of a 2-connected component
Note that the edge
between i and a
terminal node could
be “virtual”
essential nodes
i
i
w
23/40
Connecting to the new C-node
1
P
P
3
6
2
4
5
2
3
8
7
8
P
P
1
7
4
5
6
24/40
At the end of the iteration (2)
i
w
u
m
u'
25/40
The Boundary for each C-node
u
u'
u'
26/40
The Outer Boundary
for each C-node (recognition)
u
u'
u
u'
27/40
The Inner Boundary
for each C-node (embedding)
u
u'
u
u'
28/40
At the end of the Iteration (3)
• Get a 2-connected component involving i
• Create a C-node for i representing this
component
• Determine all essential nodes on the
boundary of this C-node (the boundary cycle)
– Such a boundary cycle is important for actual
implementation
29/40
Our edge addition approach compared to
the vertex addition of LEC (Bush form)
• In the Bush form, the nodes of the graph are
at the leaves of the PQ-tree.
– Internal nodes are used for permutation
• But, in our PC-tree, every P-node is an
original node (C-nodes are components)
– PC-tree more faithfully represent the partial
embedding
• In order to use the Bush form, an s-t
numbering has to be calculated and the
graph must be 2-connected.
30/40
Our Approach -- Edge addition
Start with a Depth-First-Search Tree
(with post ordering)
16
15
13
C4 3
12
C1
7
42
3
1 1
3
C2
14
12
11
10
10
3
5
6
8
8
9
31/40
How do we traverse through a
C-node (around the cycle)
Conceptually
easy, if every
node has a
parent, but this
could take
O(n2) time due
to frequent
parent change
i
i
In reality, for
linear time
implementation,
we only keep
two parent
pointers
32/40
A virtual PC-Tree
•
The original PC-tree implementation in
which every essential node has a parent
would require O(n2) time
– Their parents change very often
•
In a linear time implementation, we shall
traverse the boundary cycle to find the
parent
– only keep parent pointers for the two neighbors
of i in the boundary cycle.
– Charge the traversal to
1. Tree edge traversal
2. Boundary link traversal (FIND operation)
33/40
1. C-node Traversing (parent-finding)
charged to edges embedded inside
Parallel Search
from the entering node
i
Note that, the root
node r is never
embedded outside
One of the neighbors of i
must be embedded inside.
After the traversal, # of
nodes to be embedded
inside is  the smaller half
of the boundary cycle
34/40
How many times can an edge
be traversed?
An edge embedded inside
A tree edge
A boundary link
An edge embedded inside
35/40
2. C-node Labeling
• How do we know if a C-node is full?
– i.e. all of its children are full
• When a child is full, how does it report to the
corresponding C-node?
– If it does not have a parent pointer, FIND parent
using parallel search. After the search, give parent
pointer for every node along the search path.
• Concatenate the search path if additional FIND is
necessary
– This works because full children should be
consecutive in the boundary cycle and include a
neighbor of i
– Erase the parent pointers at the end of the
iteration
36/40
Complexity
• Tree edge traversal for labeling O(n)
– Each original edge traversed either is
embedded inside or becomes a boundary link
• Boundary Link traversal O(n)
– For every 2q links traversed, there exist at
least q links embedded inside (through
parallel search)
• Total running time =
Tree edge traversal + Link traversal = O(n)
37/40
A Necessary and Sufficient Condition
for a Graph to be Planar
• A graph is planar iff
at every iteration i, there exists a
terminal path s.t.
– nodes on this path can be flipped so that
all full subtrees lie on one side, and all
empty subtrees lie on the other side
without violating the cyclic order of any Cnode
38/40