1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.
-
date post
21-Dec-2015 -
Category
Documents
-
view
217 -
download
0
Transcript of 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.
![Page 1: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/1.jpg)
1
CIS260-201/204—Spring 2008
Recitation 10Friday, April 4, 2008
![Page 2: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/2.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/3.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/4.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/5.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/6.jpg)
6
Euler Tour: Example (cont.)
Find a cycle. Remove this cycle.
![Page 7: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/7.jpg)
7
Euler Tour: Example (cont.)
The resulting graph is still Eulerian.
Now 3 components. Again, find another
cycle. Remove it.
![Page 8: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/8.jpg)
8
Euler Tour: Example (cont.)
The resulting graph is still Eulerian.
Many components now.
Again, find another cycle.
Remove it.
![Page 9: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/9.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/10.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/11.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/12.jpg)
12
Euler Tour: Example (cont.)
Two more cycles to go.
![Page 13: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/13.jpg)
13
Euler Tour: Example (cont.)
Last cycle… And we are done!
![Page 14: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/14.jpg)
14
Hamiltonian Cycle:Example
Prove that this graph does not have a Hamiltonian cycle.
![Page 15: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/15.jpg)
15
Hamiltonian Cycle:Example (cont.)
This graph is bipartite!
Well, let’s color it.
![Page 16: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/16.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/17.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/18.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/19.jpg)
19
Hamiltonian Path:Example
Prove that this graph does not have a Hamiltonian path.
![Page 20: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/20.jpg)
20
Hamiltonian Path:Example (cont.)
Again, this graph is bipartite.
Let’s color it.
![Page 21: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/21.jpg)
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: 1 CIS260-201/204—Spring 2008 Recitation 10 Friday, April 4, 2008.](https://reader035.fdocuments.net/reader035/viewer/2022062516/56649d535503460f94a300ae/html5/thumbnails/22.jpg)
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.