Recitation 10 PowerPoint

Download Report

Transcript Recitation 10 PowerPoint

CIS260-201/204—Spring 2008
Recitation 10
Friday, April 4, 2008
1
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.
2
Euler Tour: Example




First, verify that this
graph is Eulerian.
How?
Every vertex has even
degree.
So, it has an Euler tour.
3
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.
4
Euler Tour: Example (cont.)


If the remaining graph
is still complicated (like
this), repeat the
procedure.
Note: Now there are
two connected
components.
5
Euler Tour: Example (cont.)


Find a cycle.
Remove this cycle.
6
Euler Tour: Example (cont.)




The resulting graph is
still Eulerian.
Now 3 components.
Again, find another
cycle.
Remove it.
7
Euler Tour: Example (cont.)




The resulting graph is
still Eulerian.
Many components now.
Again, find another
cycle.
Remove it.
8
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.
9
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.
10
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.
11
Euler Tour: Example (cont.)

Two more cycles to go.
12
Euler Tour: Example (cont.)


Last cycle…
And we are done!
13
Hamiltonian Cycle:
Example

Prove that this graph
does not have a
Hamiltonian cycle.
14
Hamiltonian Cycle:
Example (cont.)


This graph is bipartite!
Well, let’s color it.
15
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?
16
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.
17
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.
18
Hamiltonian Path:
Example

Prove that this
graph does not
have a Hamiltonian
path.
19
Hamiltonian Path:
Example (cont.)


Again, this graph is
bipartite.
Let’s color it.
20
Hamiltonian Path:
Example (cont.)




32 blue vertices
30 yellow vertices
Any path must be
blue, yellow, …, blue.
Is it possible to
traverse every
vertex?
21
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.
22