Planarity Testing

26
PLANARITY TESTING

description

Planarity Testing. Overview. Definitions Menger’s Theorem Ear Decomposition Lemma Pieces Planarity Testing Algorithm Complexity O(n ). 3. * We’ll only discuss connected undirected graphs. Definitions. Cut vertex Cut edge Block Two blocks share at most one vertex – cut-vertex. - PowerPoint PPT Presentation

Transcript of Planarity Testing

Page 1: Planarity Testing

PLANARITY TESTING

Page 2: Planarity Testing

OVERVIEW

o Definitions

o Menger’s Theorem

o Ear Decomposition Lemma

o Pieces

o Planarity Testing Algorithm

o Complexity O(n )

* We’ll only discuss connected undirected graphs

3

Page 3: Planarity Testing

DEFINITIONS

Cut vertex

Cut edge

Block

Two blocks share at most one vertex – cut-vertex

Connected Components:

Connected Components:

13

12

Page 4: Planarity Testing

Depth First Search

Use the DFS tree to find Blocks

DFS

G

3 4

5

767

12

DFS tree

Page 5: Planarity Testing

MENGER’S THEOREM (1927)

k-connected – deleting (k-1) vertices cannot disconnect it (|V(G)| >= k).

Corollary (Dirac 1960) –

G is 2-connected G consists of a single block

G is k-connected Any k vertices of G lie on a simple cycle

G is k-connected Any pair u, v V(G) can be connected by k vertex-disjoint paths.

Page 6: Planarity Testing

ST-ORDERING

Numbering - v1, v2, ... , vn of V(G) so that (v1, vn) E(G) vi has a neighbor vj where j < i vi also has a neighbor vk where i < k

(for every i , 1 < i < n)

G admits an st-ordering G is 2-connected

We’ll prove it soon

Page 7: Planarity Testing

Every 2-connected graph can be obtained from a cycle by adding paths

For each path: Both end points are on the current graph But otherwise it is disjoint from it

Proof Gi G, Gi ≠ G the current graph. Pick u V(Gi) , v V(Gi) such that (u, v) E(G)

and connect v to Gi by a shortest path.

EAR DECOMPOSITION LEMMA

Page 8: Planarity Testing

G is 2-connected Use induction on |E(G)| Show G admits st-ordering with

v1 = u, v2, ... , vn = v(u, v) E(G) Pick a cycle C through (u, v) Base:

G = C trivial

G ADMITS AN ST-ORDERING G IS 2-CONNECTED

u v

v2

v3

v4

(v5)(v1)

Page 9: Planarity Testing

C ≠ G

CONTINUED

u v (v5)(v1)GG0 = C

Page 10: Planarity Testing

C ≠ G Add a path to it as in the ear decomposition Number the path’s vertices so they form an

increasing chain connecting its endpoints

CONTINUED

u v (v5)(v1)

Shortest path

v3

v4

G0 = CG1

Page 11: Planarity Testing

C ≠ G Add a path to it as in the ear decomposition Number the path’s vertices so they form an

increasing chain connecting its endpoints

CONTINUED

u v (v5)(v1)

v3

v4

v2

G1G2

Page 12: Planarity Testing

G is 2-connected C is a cycle in G Pieces

C is Separating

PIECES

P1

P2

P3

Page 13: Planarity Testing

Pieces can be drawn on either side of C

PIECES

P2

P1

P3

Page 14: Planarity Testing

Pieces can be drawn on either side of C

PIECES

P2

P1

P3

Page 15: Planarity Testing

Pieces can be drawn on either side of C

PIECES

P2

P1

P3

Page 16: Planarity Testing

Pieces can be drawn on either side of C

PIECES

P2

P1

P3

Page 17: Planarity Testing

Two pieces Interlace or Conflict if they cannot be drawn on the same side of C without crossing edges

When does this happen?

PIECES

P2

P1

P3

GG’a1

b1

a3

b3

Cyclic order: a1, b1, a3, b3

a2

b2

Page 18: Planarity Testing

G’ might be a planar graph

PIECES

P2

P1

P3

G’

Page 19: Planarity Testing

G’ might be a planar graph If one of the conflicting pieces can be drawn

on the other side of C

PIECES

P2

P1

P3

G’

Page 20: Planarity Testing

Find 2 sets (S1, S2) of pieces so that: No two pieces in the same set conflict S1 S2 C = G

OUR GOAL

P2

P1

P3

G

∩ ∩

S1 = {P1, P2}S2 = {P3}

Page 21: Planarity Testing

INTERLACEMENT GRAPH

Vertex set – the set of pieces (with respect to C)

Two vertices are connected the pieces interlace

P2

P1

P3

G

Interlacement(G, C):

Page 22: Planarity Testing

IS G PLANAR?

G 2-connected graph with cycle C G is planar

For each piece P (with respect to C) P C is a planar graph

The Interlacement graph is bipartite (2-colorable)

Page 23: Planarity Testing

WHY?

P2

P1

P3

G Interlacement(G, C):

If Interlacement(G, C) is bipartite, we can divide the pieces to 2 sets -

like we wanted

S1

S2

Page 24: Planarity Testing

WHY?

Each piece combined with C is a planar graph And we can assemble all the pieces together

so that they don’t interlace So G is planar

Page 25: Planarity Testing

(

G 2-connected graph with n vertices O(n) edges

C is a cycle in G

The Algorithm: Find pieces with respect to C Build interlace graph Check if it is bipartite Check planarity for C’s pieces (recursively)

PLANARITY TESTING RECURSIVE ALGORITHM

O(n)

O(n)

O(n )2

O(n )2

+

+ )*

Total Cost = O(n )3

Page 26: Planarity Testing

Questions?