cis260-201/204—spring 2008

22
1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008

Upload: sani

Post on 19-Jan-2016

31 views

Category:

Documents


0 download

DESCRIPTION

CIS260-201/204—Spring 2008. Recitation 10 Friday, April 4, 2008. Recap: Proof of Euler Tour. Let G be an Eulerian graph. Find a cycle C in G . (A cycle exists.) Remove C . Get a smaller graph. By inductive hypothesis, each connected component has an Euler tour. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CIS260-201/204—Spring 2008

1

CIS260-201/204—Spring 2008

Recitation 10Friday, April 4, 2008

Page 2: CIS260-201/204—Spring 2008

2

Recap: Proof of Euler Tour Let G be an Eulerian graph. Find a cycle C in G. (A cycle exists.) Remove C. Get a smaller graph. By inductive hypothesis, each connected

component has an Euler tour. The Euler tour of G is obtained by

traversing C and diverge to the Euler tour of each component when we encounter it.

Example will help.

Page 3: CIS260-201/204—Spring 2008

3

Euler Tour: Example

First, verify that this graph is Eulerian.

How? Every vertex has

even degree. So, it has an Euler

tour.

Page 4: CIS260-201/204—Spring 2008

4

Euler Tour: Example (cont.)

Find a cycle. Remove this cycle. The remaining graph

is still Eulerian. So, we can find an

Euler tour in the remaining graph.

Page 5: CIS260-201/204—Spring 2008

5

Euler Tour: Example (cont.)

If the remaining graph is still complicated (like this), repeat the procedure.

Note: Now there are two connected components.

Page 6: CIS260-201/204—Spring 2008

6

Euler Tour: Example (cont.)

Find a cycle. Remove this cycle.

Page 7: CIS260-201/204—Spring 2008

7

Euler Tour: Example (cont.)

The resulting graph is still Eulerian.

Now 3 components. Again, find another

cycle. Remove it.

Page 8: CIS260-201/204—Spring 2008

8

Euler Tour: Example (cont.)

The resulting graph is still Eulerian.

Many components now.

Again, find another cycle.

Remove it.

Page 9: CIS260-201/204—Spring 2008

9

Euler Tour: Example (cont.)

The resulting graph is still Eulerian.

Now simple enough to see all the Euler tours of each nontrivial component.

So, ready to construct the tour for the whole graph.

Page 10: CIS260-201/204—Spring 2008

10

Euler Tour: Example (cont.)

Start at the vertex on a cycle we removed.

Once we encounter a vertex having an Euler tour attached to it, traverse that tour.

Page 11: CIS260-201/204—Spring 2008

11

Euler Tour: Example (cont.)

When done, go back to previous cycles…

… and do the same. In this case we don’t

encounter any other tour.

Page 12: CIS260-201/204—Spring 2008

12

Euler Tour: Example (cont.)

Two more cycles to go.

Page 13: CIS260-201/204—Spring 2008

13

Euler Tour: Example (cont.)

Last cycle… And we are done!

Page 14: CIS260-201/204—Spring 2008

14

Hamiltonian Cycle:Example

Prove that this graph does not have a Hamiltonian cycle.

Page 15: CIS260-201/204—Spring 2008

15

Hamiltonian Cycle:Example (cont.)

This graph is bipartite!

Well, let’s color it.

Page 16: CIS260-201/204—Spring 2008

16

Hamiltonian Cycle:Example (cont.)

13 yellow vertices 12 blue vertices Any cycle must be

yellow, blue, yellow, blue, …, blue, yellow (first vertex).

Is it possible to traverse every vertex and come back to the first vertex?

Page 17: CIS260-201/204—Spring 2008

17

Hamiltonian Cycle:Example (cont.)

Start with a blue vertex.

blue, yellow, blue, yellow, …, blue, yellow.

One yellow vertex left! Can’t start with a blue.

Page 18: CIS260-201/204—Spring 2008

18

Hamiltonian Cycle:Example (cont.)

Start with a yellow vertex. yellow, blue, yellow, blue,

…, yellow, blue, yellow. But the first and last

vertices are yellow. Can’t get back to the first

vertex. Can’t start with a yellow. Can’t start with anything! No Hamiltonian cycle.

Page 19: CIS260-201/204—Spring 2008

19

Hamiltonian Path:Example

Prove that this graph does not have a Hamiltonian path.

Page 20: CIS260-201/204—Spring 2008

20

Hamiltonian Path:Example (cont.)

Again, this graph is bipartite.

Let’s color it.

Page 21: CIS260-201/204—Spring 2008

21

Hamiltonian Path:Example (cont.)

32 blue vertices 30 yellow vertices Any path must be

blue, yellow, …, blue.

Is it possible to traverse every vertex?

Page 22: CIS260-201/204—Spring 2008

22

Hamiltonian Path:Example (cont.)

Even starting with a blue vertex, we can’t get to all blue vertices because there are not enough yellow vertices.

Starting with a yellow vertex is out of question; we can’t visit every blue vertex.

No Hamiltonian path.