1 cis260-201/204—spring 2008 recitation 10 friday, april 4, 2008

Post on 21-Dec-2015

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

CIS260-201/204—Spring 2008

Recitation 10Friday, April 4, 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.

3

Euler Tour: Example

First, verify that this graph is Eulerian.

How? Every vertex has

even degree. So, it has an Euler

tour.

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.

5

Euler Tour: Example (cont.)

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

Note: Now there are two connected components.

6

Euler Tour: Example (cont.)

Find a cycle. Remove this cycle.

7

Euler Tour: Example (cont.)

The resulting graph is still Eulerian.

Now 3 components. Again, find another

cycle. Remove it.

8

Euler Tour: Example (cont.)

The resulting graph is still Eulerian.

Many components now.

Again, find another cycle.

Remove it.

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.

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.

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.

12

Euler Tour: Example (cont.)

Two more cycles to go.

13

Euler Tour: Example (cont.)

Last cycle… And we are done!

14

Hamiltonian Cycle:Example

Prove that this graph does not have a Hamiltonian cycle.

15

Hamiltonian Cycle:Example (cont.)

This graph is bipartite!

Well, let’s color it.

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?

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.

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.

19

Hamiltonian Path:Example

Prove that this graph does not have a Hamiltonian path.

20

Hamiltonian Path:Example (cont.)

Again, this graph is bipartite.

Let’s color it.

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?

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.

top related