planar graphs. a graph is called planar if it can be drawn in the plane in such a way that no two...

55
Planar Graphs Planar Graphs

Upload: sabina-washington

Post on 05-Jan-2016

244 views

Category:

Documents


0 download

TRANSCRIPT

Planar GraphsPlanar Graphs

A graph is called planar if it can be drawn in the plane in such a way that no two edges cross.

Example of a planar graph:

4K

The clique on 4 nodes.

A graph is called planar if it can be drawn in the plane in such a way that no two edges cross.

Example of a planar graph:

4K

The clique on 4 nodes.

Is K5 planar

?

What about K3,3 ?

The problem of drawing a graph in the plane arises frequently in VLSI layout problems.

Definition: When a graph is drawn in the plane with no crossed edges, this particular embedding of the graph in the plane, it is called a plane graph. A plane graph cuts the plane into regions that we call faces.

one face two faces

Question:

Can you redraw this graph as a plane graph so as to alter the number of its faces?

This graph

has 6 vertices 8 edges and 4 faces

vertices – edges + faces = 2

This graph

has 7 vertices 12 edges and 7 faces

vertices – edges + faces = 2

Euler Euler 17521752

If G is a connected plane graph, then

vertices – edges + faces = 2

Let v = # of vertices e = # of edges f = # of faces

[ 1] 1

1 1

2

v e f v v

Proof: By induction on the # of cycles of G.

Base case: G has no cycles.

G is connected so it must be a tree. Thus, e = v - 1 and f = 1.

Suppose G has at least one cycle C containing edge e.

• G is connected since e was on a cycle.

• f = f-1 and G has fewer cycles than G.

• v= v e= e-1

By induction hypothesis:

2

1 1 2

2

v e f

v e f

v e f

v= # of vertices, e = # of edges,f = # of faces

exterior

e interior

G G e Let

Corollary:

No matter how we redraw a plane graph it will have the same # of faces.

Proof:

f = 2 – v + e is determined by v and e, neither of which change when we redraw the graph.

Platonic SolidsPlatonic SolidsA Platonic solid has congruent regular polygons as faces and has the same number of edges meeting at each corner.Each one can be flattened into a planar graph:

With constant degree: kand the same number of edges bounding each face: l

2kv e

2e

=

kv

# of edgescoming from x

vertex x

2fl eEach edge belongs to 2 faces:

2v e f By Euler’s formula:

2 4 2 42 2 2 2 4

f vk l k l

f v

and k,l 3 for physical reasons

The only solutions:

3 3 6 4 4

3 4 12 8 6

4 3 12 6 8

3 5 30 20 12

5 3 30 12 20

k l e v f

tetrahedron

cube

octahedron

dodecahedron

icosahedron

Theorem: Every (simple) n-node planar graph G has at most 3n-6 edges.Proof: n = 3: Clearly true.n 3: consider a graph G with a maximal number of edges.

2n e f Thus

•G must be connected or else we could add an edge.

Every face has at least 3 edges on its boundary.

Every edge lies on the boundary of at most 2 faces.

2

3 3 3 6

3 3 2 6

3 6

n e f

n e f

n e e

e n

Thus2 3e f

The Kuratowski GraphsThe Kuratowski Graphs

3,3K

5K

Corollary: K5 is not planar.

5n 5

102

e

A planar graph on n = 5 nodes can have at most 3n-6 = 9 edges.

Thus: K5 is not planar.

Fact: K3,3 is not planar either.

a

c

b

z

y

x

When we redraw K3,3 , the yellow cycle will be laid out:

a b

c

x

yz

For K3,3, each region has at least 4 edges, Hence 4f <= 2e. If K3,3 is planar, f = e - n + 2 = 9 – 6 + 2 = 5. So 20=4f <= 2e=18,a contradiction.

Fact: K3,3 is not planar either.

Insight 1.

If we replace edges in a Kuratowski graph by paths of whatever length, they remain non-planar.

Insight 2

If a graph G contains a subgraph obtained by starting with K5 or K3,3 and replacing edges with paths, then G is non-planar.

Elementary subdivision (homeomorphic operation)

u w u v w

G1 and G2 are called homeomorphic if they are isomorphicor if they can both be obtained from the same loop-free undirected graph H by a sequence of elementary subdivisions.

a b

cde

a b

cde

a b

cde

a b

cde

Two homeomorphic graphs are simultaneously planar or nonplanar.

Kuratowski’s Theorem Kuratowski’s Theorem [1930][1930]

A graph is planar if and only if it contains no subgraph obtainable from K5 or K3,3 by replacing edges with paths.

Appel-Haken Four-Color Appel-Haken Four-Color Theorem [1976]Theorem [1976]

The vertices of any planar graph can be 4-colored in such a way that no two adjacent vertices receive the same color.

Five Color TheoremFive Color Theorem

Any planar graph can be colored Any planar graph can be colored with five colors.with five colors.

Lemma: Every Planar Graph Lemma: Every Planar Graph Contains a Node of Degree Contains a Node of Degree ··

55

If every node has degree at least 6, If every node has degree at least 6, then the number of edges would be then the number of edges would be 3n, which would contradict our 3n, which would contradict our upper bound of 3n-6 edges in an n-upper bound of 3n-6 edges in an n-node planar graph.node planar graph.

Proof of 5-color theoremProof of 5-color theorem

Let G be a Let G be a node-minimalnode-minimal counter- counter-example to the theorem, i.e., a planar example to the theorem, i.e., a planar graph that requires 6 colors.graph that requires 6 colors.

By Lemma, G must have a node q By Lemma, G must have a node q with degree with degree ·· 5. Let the nodes 5. Let the nodes adjacent to q be named vadjacent to q be named v11, v, v22, v, v33, v, v44, , and vand v55..

VV11, V, V22, V, V33, V, V44, V, V55 can’t form a can’t form a KK55

Some two Some two neighbors neighbors vvaa, , and and vvbb of q must of q must not have an not have an edge between edge between them.them.

vvaa

vvbb

Edge ContractionEdge Contraction

Contract the Contract the edges <q, edges <q, vvaa> > and <q,and <q,vvbb> of G > of G to obtain a to obtain a planar graph G’. planar graph G’. G’ is 5 colorable G’ is 5 colorable since it has fewer since it has fewer nodes than G.nodes than G.

vvaa

vvbb

va, vb, and q become a

single node in G’

Using G’ to 5-color G.Using G’ to 5-color G.

Color vColor vaa and v and vbb the the same as same as . Color . Color each node each node besides q, as it is besides q, as it is colored in G’. colored in G’. Color q whatever Color q whatever color is not used color is not used on its 5 neighbors.on its 5 neighbors.

vvaa

vvbb

va, vb, and q become a

single node in G’

11.5 Hamilton Paths and Cycles

a path or cycle that contain every vertex

Unlike Euler circuit, there is no knownnecessary and sufficient condition for a graph to be Hamiltonian.

Ex. 11.24 a b c

d e f

g hi

There is a Hamilton path, but no Hamilton cycle.

an NP-complete problem

11.5 Hamilton Paths and Cycles

Ex. 11.25x

yy y y

x x

x

y

y

start labeling from here

4x's and 6y's, since x and y mustinterleave in a Hamilton path (or cycle),the graph is not Hamiltonian

The method works only for bipartite graphs.

The Hamilton path problem is still NP-complete when restrictedto bipartite graphs.

11.5 Hamilton Paths and Cycles

Ex. 11.26 17 students sit at a circular table, how many sittings arethere such that one has two different neighbors each time?

Consider K17, a Hamilton cycle in K17 corresponds to a seatingarrangements. Each cycle has 17 edges, so we can have (1/17)17(17-1)/2=8 different sittings.

12

3

4

5

6

17

16

15

1,2,3,4,5,6,...,17,1

12

3

4

5

6

17

16

15

1,3,5,2,7,4,...,17,14,16,1

12

3

4

5

6

17

16

15

1,5,7,3,9,2,...,16,12,14,1

14

11.5 Hamilton Paths and Cycles

Theorem 11.7 Let be a complete directed graph, i.e. , has vertices and for any distinct pair , of vertices, exactlyone of the edges ( , ) or ( , ) is in Such a graph (called a

) always contains a directed Hamilton path.Proof: Let 2 with a path containing -1 edges ( If = , we' re finished. Ifnot, let be a vertex that doesn' t appear in

* *

*

K Kn x y

x y y x Ktournament

m p mv v v v v v m n

v p

n n

n

mm m

m

.

, ), ( , ), , ( , )..

1 2 2 3 1

case 1. v v1 v2 ...vm

case 2. v1 v2 ...vk v vk+1 ...vm

case 3. v1 v2 ...vm v

11.5 Hamilton Paths and Cycles

Ex. 11.27 In a round-robin tournament each player plays everyother player exactly once. We want to somehow rank the playersaccording to the result of the tournament.

not always possible to have a ranking where a player in a certainposition has beaten all of the opponents in later positions

a b c

but by Theorem 11.7, it is possible to list the players such thateach has beaten the next player on the list

11.5 Hamilton Paths and Cycles

Theorem 11.8 Let = ( , ) be a loop - free graph with | |= 2. If deg( ) + deg( ) -1 for all , , , then

has a Hamilton path.

G V EV n x y n x y V x yG

Proof: First prove that G is connected. If not,

x yn1 vertices n2 vertices

deg( ) deg( ) ( ) ( )x y n n n n n n 1 2 1 2 1 21 1 2 1

a contradiction

11.5 Hamilton Paths and Cycles

Theorem 11.8 Let = ( , ) be a loop - free graph with | |= 2. If deg( ) + deg( ) -1 for all , , , then

has a Hamilton path.

G V EV n x y n x y V x yG

Assume a path pm with m vertices v1 v2 v3 ... vm

case 1. either v v1 or vm v

case 2. v1,v2,...,vm construct a cycle either v1 v2 v3 ... vm

or v1 v2 v3 ...vt-1 vt ... vm

otherwise assume deg(v1)=k, then deg(vm)<m-k.deg(v1)+deg(vm)<m<n-1, a contradiction

Therefore, v can be added to the cycle. v

11.5 Hamilton Paths and Cycles

Corollary 11.4. If deg( )-

for all vertices, then the graph

has a Hamilton path.

Theorem 11.9 Let = ( , ) be a loop - free undirected graph with | |= 3. If deg( ) + ( ) for all nonadjacent

, , then contains contains a Hamilton cycle.

vn

G V EV n x y n

x y V G

1

2

deg

Proof: Assume G does not contain a Hamilton cycle. We add edges to G until we arrive a subgraph H of Kn where H has no Hamiltoncycle, but for any edge e not in H, H+e has a Hamilton cycle.

For vertices a,b wher (a,b) is not an edge of H. H+(a,b) has aHamilton cycle and (a,b) is part of it.

11.5 Hamilton Paths and Cycles

a(=v1) b(=v2) v3 ... vn

If (b,vi) is in H, then (a,vi-1) cannot be in H. Otherwise,b vi vn a vi-1 vi-2 v3 is a Hamilton cycle in H.

Consequently, deg which meansdeg a contradiction.

Corollary 11.5 If deg( ) for all vertices, then the graph has a

Hamilton cycle.

H HG G

a b na b n

vn

( ) deg ( ) ,( ) deg ( ) ,

2

11.5 Hamilton Paths and Cycles

Corollary 11.6 If = ( , ) is a loop - free unirected graph with

| |= 3, and if | |-

then has a Hamilton cycle.

Proof: Let , where ( , ) . Remove all edges connectedeither to or and then , . Let = ( ' , ' ) denote the resultingsubgraph. Then | |=| ' |+ ( ) + ( ). Since | ' |= - ,

| ' |-

Consequently, -

| ' |+ ( ) + ( )

-

G V E

V n En

G

a b V a b Ea b a b H V E

E E a b V n

En n

E E a b

n

1

22

22

2

1

22

2

,

deg deg

. | | deg deg

21

22

2

2

+ ( ) + ( ). Therefore, ( ) + ( )

- -

and has a Hamilton cycle.

deg deg deg dega b a b

n nn G

11.5 Hamilton Paths and Cycles

A related problem: the traveling salesman problem

a

b

c

d

e3

41

3

5 4

32

Find a Hamilton cycle of shortest total distance.

2 graph problem vs. Euclidean plane problem (computational geometry)

Certain geometry properties (for example, the triangle inequality) sometimes (but not always) make it simpler.

For example, a-b-e-c-d-a with total cost=1+3+4+2+2=12.

11.5 Hamilton Paths and Cycles

Two famous computational geometry problems.

1. closest pair problem: which two points are nearest2. convex hull problem

the convex hull

11.6 Graph Coloring and Chromatic Polynomials

Def. 11.22 If G=(V,E) is an undirected graph, a proper coloringof G occurs when we color the vertices of G so that if (a,b) is anedge in G, then a and b are colored with different colors. Theminimum number of colors needed to properly color G is calledthe chromatic number of G and is written (G).

b

c

d

e

a3 colors are needed.a: Redb: Greenc: Redd: Bluee: Red

In general, it's a very difficult problem (NP-complete).

(Kn)=n

(bipartite graph)=2

11.6 Graph Coloring and Chromatic Polynomials

A related problem: color the map where two regions arecolored with different colors if they have same boundaries.

G

R e

B

BR

Y

Four colors are enough for any map. Remaina mystery for a century. Proved with the aid of computer analysis in 1976.

a b

c

df

a

b

c

d

e

f

11.6 Graph Coloring and Chromatic Polynomials

P(G,): the chromatic polynomial of G=the number of waysto color G with colors.

Ex. 11.31 (a) G=n isolated points, P(G,)=n.(b) G=Kn, P(G,)=(-1)(-2)...(-n+1)=(n)

(c) G=a path of n vertices, P(G,)=(-1)n-1.(d) If G is made up of components G1, G2, ..., Gk, then P(G,)=P(G1,)P(G2,)...P(Gk,).

Ex. 11.32e

G eG eG'

coalescing the vertices

11.6 Graph Coloring and Chromatic Polynomials

Theorem 11.10 Decomposition Theorem for Chromatic Polynomials.If G=(V,E) is a connected graph and e is an edge, then P(Ge,)=P(G,)+P(G'e,).

e

G eG eG'

coalescing the vertices

a

b

In a proper coloring of Ge:case 1. a and b have the same color: a proper coloring of G'e case 2. a and b have different colors: a proper coloring of G.Hence, P(Ge,)=P(G,)+P(G'e,).

Chapter 11 An Introduction to Graph Theory11.6 Graph Coloring and Chromatic Polynomials

Ex. 11.33

e = -

P(Ge,)P(G,) P(G'e,)

P(G,)=(-1)3-(-1)(-2)=4-43+62-3Since P(G,1)=0 while P(G,2)=2>0, we know that (G)=2.

Ex. 11.34

= - = -2

e e

P(G,)=(4)-2(4)= (-1)(-2)2(-3) (G)=4

User InterfaceUser InterfaceHow many objects appear in the pink window?

(real-time response required)

4

2

3

Idea: View each rectangle as a mesh.

1 1v e f

interiorfaces

2v e f (mesh is planar)

Objects are placed on an n n grid.

Data structure will contain:•for each grid node

# objects containing node

•for each grid edge# objects containing edge

•for each (interior) face#objects containing face

window border touches no nodes

Partial Overlap of Window and Object

ignore object’s nodes and edges outside window

1 1v e f

edge counts in

node counts in

face counts in

# of objects intersecting