planarity testing and embedding

64
PLANARITY TESTING AND EMBEDDING By: Seyed Akbar Mostafavi Fall 2010 1

Upload: dex

Post on 22-Feb-2016

74 views

Category:

Documents


1 download

DESCRIPTION

Planarity Testing And Embedding. By: Seyed Akbar Mostafavi Fall 2010. Outline. Planar Graphs Planarity Testing Theorems Kuratowski’s Theorem Demoucron’s Planarity Algorithms Euler Polyhedron Formula Nonplanarity of Kuratowski Graphs Minimum Degree Bound - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Planarity Testing And Embedding

PLANARITY TESTING AND EMBEDDING

By: Seyed Akbar MostafaviFall 2010

1

Page 2: Planarity Testing And Embedding

2

OUTLINE Planar Graphs Planarity Testing Theorems

Kuratowski’s Theorem Demoucron’s Planarity Algorithms Euler Polyhedron Formula Nonplanarity of Kuratowski Graphs Minimum Degree Bound

Definitions of Planarity Testing st-numbering Algorithm Bush Form and PQ-Tree Booth-Lueker Algorithm Embedding Algorithms

Page 3: Planarity Testing And Embedding

3

PLANAR GRAPHS A graph G(V,E) is called planar graph if it

can be drawn on embedded in the plane in such a way that the edges of the embedding intersect only at the vertices of G.

Example: K(4)

Page 4: Planarity Testing And Embedding

4

PLANAR GRAPHS Nonplanar Graph example: K(3,3)

Page 5: Planarity Testing And Embedding

5

PLANARITY TESTING Two classical approaches

Theorem of Kuratowski Characterizes planar graphs in terms of subgraphs

they are forbidden to have Based on the notion of homeomorphism Series insertion: replacement of an edge (u,v) of G by

a pair of edges (u,z) and (z,v) Series deletion: replacement of a pair of edges (u,z)

and (z,v) of G by a single edge (u,v) Hopcraft and Tarjan Algorithm

determines planarity in linear time and shows how to draw the graph if it is planar

Page 6: Planarity Testing And Embedding

6

KURATOWSKI’S THEOREM A graph G(V,E) is planar if and only if G

contains no subgraph homeomorphic to either K(5) or K(3,3)

Example: Petersen’s Graph

Page 7: Planarity Testing And Embedding

7

CONTRACTION FORM OF KURATOWSKI’S THEOREM Contraction: operation of removing an edge

(u,v) from a graph G and identifying the endpoints u and v (with a single new vertex uv) so that every edge originally incident with either u and v becomes incident with uv.

Graph (V,E) is said contractible to a graph (V,E) if can be obtained from by a sequence of contractions.

Theorem: A graph G(V,E) is planar if and only if G contains no subgraph contractible to either K(5) or K(3,3).

Page 8: Planarity Testing And Embedding

8

DEMOUCRON’S PLANARITY ALGORITHM Terminology

face of a planar representation: a planar region bounded by edges and vertices of the representation and containing no graphical elements in its interior.

R: a planar representation of a subgraph S of a graph G(V,E)

We try to extend R to a planar representation of G Constraints

Each component of G-R, being a connected piece of the graph, must, in any planar extension of R, be placed within a face of R.

Further constraint is observed by considering those edges connecting a component c of G-R to set of vertices W in R.

All the vertices W in R must lie on the boundary of a single face in R. Otherwise, c would have to straddle more than one face of R.

Page 9: Planarity Testing And Embedding

9

TERMINOLOGY (MORE) A part p of G relative to R is defined as

1) An edge (u,v) in E(G) – E(R) such that u and v or2) A component of G – R together with the edges (called

pending edges) that connect the component to the vertices of R.

Contact vertex of a part p of G relative to R is defined as a vertex of G – R that is incident with a pending edge of p

A planar representation R of a subgraph S of a planar graph G is planar extensible to G if R can be extended to a planar representation of G.

A part p of G relative to R is drawable in a face of R if there is a planar extension of R to G where p lies in f.

Page 10: Planarity Testing And Embedding

10

DEMOUCRON’S ALGORITHM Idea: we repeatedly extend a planar representation

R of a subgraph of graph G until either R equals G or the procedure becomes blocked in which case G is nonplanar.

1) We start by taking R to be an arbitrary cycle from G2) We then partition the remainder of G not yet

included in R into parts of G relative to R and apply drawability condition.

3) We identify those faces of R in which p is potentially drawable, a path q through p, and add q to R by drawing it through f in a planar matter.

4) Process is blocked only if we find some part that doesn’t satisfy the drawability condition for any face in which case R is not planar extensible to G.

Page 11: Planarity Testing And Embedding

11

DECOUCRON’S ALGORITHM PSEUDO-CODEFunction Draw (G, R)(* Returns a planar representation of G in R)Var G: Graph

R: Planar Representationp: PartP: set of Partf: FaceF: Set of FaceDraw: Boolean function

Set Draw to TrueSet R to some cycle in G

repeatSet P to the set of parts of R relative to Gfor each p in P do Set F(p) to the set of faces of R

in which p is drawableif F(p) is empty for any pthen Set Draw to False

Page 12: Planarity Testing And Embedding

12

DECOUCRON’S ALGORITHM PSEUDO-CODE

else if For some part p, F(p) contains only a single facethen Let f be the face in which p is drawableelse Let p be any part and let f be a face in F(p)

Let q be a path between a pair of contact vetices of p with R that contains only edges of pSet R to

until R = G or not DrawEnd_function_Draw

Page 13: Planarity Testing And Embedding

13

EXAMPLE OF CONSTRUCTION OF PATH

Page 14: Planarity Testing And Embedding

14

PLANAR GRAPH THEORY Theorem (Euler Polyhedron Formula).

Let G(V,E) be a connected planar graph and |F| denote the number of faces in a planar embedding of G. Then

Proof: induction on the number of edge

Page 15: Planarity Testing And Embedding

15

PLANAR GRAPH THEORY (CONT’) Theorem (Linear bound on |E|). If G(V, E) is a planar

graph, then

Proof: We let denote the number of edges bounding the face of some planar representation of G. Each face must contains at least 3 bounding edges. Therefore,

Since each edge borders exactly two faces, the summation counts each edges twice. Therefore,

Combining these results and using the Euler Polyhedron Formula, we obtain

Page 16: Planarity Testing And Embedding

16

PLANAR GRAPH THEORY (CONT’) Theorem (Nonplanarity of Kuratowski

Graphs). The graphs K(3,3) and K(5) are nonplanar.

Proof. Nonplanarity of K(5) follows by contradiction from the Linear Bound Theorem. For K(3,3), we argue as follows.

By Euler’s Theorem, |F| = |E| - |V| + 2 = 5. However, since every cycle in K(3,3) has at least four edges, similar to proof of Linear Bound Theorem, we would have

whence emulating the Linear Bound proof, we could conclude that so that , contrary to the previous lower bound of 5.

Page 17: Planarity Testing And Embedding

17

PLANAR GRAPH THEORY (CONT’) Minimum Degree Bound. If G(V,E) is a

planar graph, . Proof (by contradiction). Suppose that the

minimum degree of G is at least 6. then

Since the sum of the degrees is always 2|E|, it follows that |E| is at least 3|V|, contrary to the Linear Bound Theorem.

Page 18: Planarity Testing And Embedding

18

VERTEX ADDITION ALGORITHM Vertex Addition Algorithm is based on s-t

numbering, that assigns an index to each vertex.

Graph is represented by a set of n lists, called “adjacency lists” Adj(v)

The adjacency list of a vertex contains all its neighbors

An embedding of a graph determines the order of the neighbors embedded around a vertex.

A graph is planar if and only if all the 2-connected components are planar [Har72].

Corollary 1.1: ; otherwise the graph is nonplanar

From: Planar Graphs

Page 19: Planarity Testing And Embedding

19

DEFINITION OF S-T NUMBERING An st-numbering is numbering 1, . . . , n of

the vertices of a graph such that Vertices “1” and “n” are adjacent Every other vertex j is adjacent to two vertices i

and k such that Vertex “1” is the source s and vertex “n” the

sink t Every 2-connected graph G has an st-

numbering, and an algorithm given by Even and Tarjan finds an st-numbering in linear time.

Page 20: Planarity Testing And Embedding

20

DEPTH-FIRST SEARCH Start with arbitrary edge (t, s) Compute for each vertex its depth-first

number DFN(v), its parent FATH(v) and its lowpoint LOW(v)

LOW(v) = min({v} {w| there exists a back edge (u,w) such that

u is a descendant of v and w is an ancestor of v in a DFS tree T})

Definition( Lowpoint)

LOW(v) = min({v} {LOW(x)|x is a son of v} {w|(v,w) is a back edge}

Page 21: Planarity Testing And Embedding

21

DFS ALGORITHMProcedure DFS(G);

procedure SEARCH(v)

begin

mark v “old”;

DFN(v) := COUNT;

COUNT := COUNT + 1;

LOW(v) := DNF(v);for each vertex w on Adj(v)

do if w is marked “new”

then begin

add (v,w) to T

FATH(w):=v;

SEARCH(w);

LOW(v) := min{LOW(v) , LOW(w)}

end

else if w is not FATH(v)

then LOW(v) := min {LOW(v), DFN(w)}

end;

Page 22: Planarity Testing And Embedding

22

PARTITION EDGES TO PATHS Vertices s, t and edge (s, t) are marked “old”Case 1 There is a “new” back edge (v,w)

Mark (v,w) “old” Return vw

Case 2 There is a “new” tree edge (v,w) Let w w1 w2 . . .wk be the path to the lowpoint wk of v Mark vertices and edges on the path “old” Return v w w1 w2 . . .wk

Case 3 There is a “new” back edge (w, v) Let w w1 w2 . . .wk be the path going backward to an old

vertex wk Mark vertices and edges on the path “old” Return v w w1 w2 . . .wk

Case 4 All edges incident to v are “old” Return

Page 23: Planarity Testing And Embedding

23

ST-NUMBERING Special nodes: source s (“1”) and sink t (“n”)

“1” and “n” adjacent j V-{s,t}: i, k Adj(j)st(i)<st(j)<st(k)

So 2 must be next to 1and n-1 must be next to n

4 6

2

5

71

3

8

Page 24: Planarity Testing And Embedding

24

SOME ST-NUMBERING EXAMPLES

12

1

11

2

10

3

9

4

8

5

7

6

31

5

2

4

Page 25: Planarity Testing And Embedding

25

ST-NUMBERING

Theorem:Every biconnected graph has an st-numbering

Proof:We give an algorithm and show that it works if the graph is biconnected

Our graph is biconnected, so anst-numbering exists.

Page 26: Planarity Testing And Embedding

26

FINDING AN ST-NUMBERING

First step: standard DFS. Can visit children in any order Calculate and store per vertex:

Parent “Depth first search number:” DFN Low-point: the lowest DFN among nodes that can be

reached by a path using any amount of tree edges followed by 1 back edge

Page 27: Planarity Testing And Embedding

27

G

Page 28: Planarity Testing And Embedding

28

DFS

G

Page 29: Planarity Testing And Embedding

291

2

3

4

5

6 DFN

DFS

G

Page 30: Planarity Testing And Embedding

1

2

3

4

5

6DFN

1

1

1

1

3

3LOW

DFS

G

30

Page 31: Planarity Testing And Embedding

31

FINDING AN ST-NUMBERING

Push the vertices onto a stack and pop them off Four rules for what to push and pop Assign increasing numbers to the vertices when

they are popped off for the last time

Example follows

Page 32: Planarity Testing And Embedding

INITIAL SETUP

The node with DFN 2 is called the ‘source’ The node with DFN 1 is called the ‘sink’

Stack with sourceon top of sink

Source and sinkare “old”

c

f

d

b

e

a

ac

32

Page 33: Planarity Testing And Embedding

33

RULE “2” There is a “new” tree edge: follow it and

take the path that leads to its low point Push the vertices on the path onto

the stack Mark all as old.

c

f

d

b

e

aabc

Page 34: Planarity Testing And Embedding

34

NO MATCHES FOR VERTEX A There are now no rule matches for a. Pop it off the stack and give it the next

available number This node is ready

c

f

d

b

e

1

bc

Page 35: Planarity Testing And Embedding

35

RULE “3” There is a “new” back edge into this node:

from the other end, go back up tree edges to an “old” vertex

Push the vertices onthe path ontothe stack

Mark all as old

c

f

d

b

e

1 bfedc

Page 36: Planarity Testing And Embedding

36

NO MATCHES FOR VERTEX B So the vertex is ready and gets its number

c

f

d

2

e

1fedc

Page 37: Planarity Testing And Embedding

37

NO MATCHES FOR VERTEX F So the vertex is ready and gets its number

c

3

d

2

e

1edc

Page 38: Planarity Testing And Embedding

38

ET CETERA…

6

3

5

2

4

1

Page 39: Planarity Testing And Embedding

39

EXAMPLE OF S-T NUMBERING

1

2

3

4

5

6

Page 40: Planarity Testing And Embedding

40

BUSH FORM Let = ( , ) be the subgraph induced by the

vertices = {1, . . . , k} Let be the graph formed by adding all edges

with ends in V − , where the ends of the edges are kept separate

These edges are called virtual edges and their ends virtual vertices

A bush form of is an embedding of such that the virtual vertices are on the outer face

Page 41: Planarity Testing And Embedding

41

EXAMPLE OF BUSH FORM

st-numbering

𝐺4 bush form

Page 42: Planarity Testing And Embedding

42

PQ-TREE DATA STRUCTURE Use PQ-tree to represent bush form PQ-tree consists of

P-nodes Represents a cut vertex of , and its children can be permuted arbitrarilyQ-nodes Represents a 2-connected component of , and its children are only allowed to reverseleaves Represents a virtual vertex of

PQ-tree represents all the permutations and reversions possible in a bush form

Page 43: Planarity Testing And Embedding

43

EXAMPLE OF PQ-TREE

bush form PQ-tree

Page 44: Planarity Testing And Embedding

44

VERTEX ADDITION ALGORITHM

Idea of the algorithm is to test planarity of +1 by finding these permutations and reversions

The permutations and reversions can be found by applying 9 transformation rules to the PQ-tree (template matching)

A leaf labeled “k + 1” is pertinent and a pertinent subtree is a minimal subtree of a PQ-tree containing all the pertinent leaves

A node of a PQ-tree is full if all the leaves of its descendants are pertinent

If we have a bush form of a subgraph of a planar graph G, then there exists a sequence of permutations and reversions to make all virtual vertices labeled “k + 1” occupy consecutive positions

Lemma

Page 45: Planarity Testing And Embedding

45

TEMPLATE MATCHINGS

Page 46: Planarity Testing And Embedding

46

TEMPLATE MATCHINGS

Page 47: Planarity Testing And Embedding

47

TEMPLATE MATCHINGS

Page 48: Planarity Testing And Embedding

48

TEMPLATE MATCHINGS

Page 49: Planarity Testing And Embedding

49

PQ-TREE REDUCTION EXAMPLE

Page 50: Planarity Testing And Embedding

50

Page 51: Planarity Testing And Embedding

51

Page 52: Planarity Testing And Embedding

52

Page 53: Planarity Testing And Embedding

53

Page 54: Planarity Testing And Embedding

54

Page 55: Planarity Testing And Embedding

55

PLANARITY TESTING ALGORITHM1. Assign st-numbers to the vertices of

G2. Construct PQ-tree corresponding to 3. Gather pertinent leaves by applying

the template matching4. If the reduction fails then G is

nonplanar5. Replace full nodes of the PQ-tree by

a new P-node6. Goto 3

Page 56: Planarity Testing And Embedding

56

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 57: Planarity Testing And Embedding

57

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 58: Planarity Testing And Embedding

58

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 59: Planarity Testing And Embedding

59

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 60: Planarity Testing And Embedding

60

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 61: Planarity Testing And Embedding

61

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 62: Planarity Testing And Embedding

62

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 63: Planarity Testing And Embedding

63

EXAMPLE OF VERTEX ADDITION ALGORITHM

Page 64: Planarity Testing And Embedding

64

EXAMPLE OF VERTEX ADDITION ALGORITHM