This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Chapter 3 NP Completeness III By Sariel Har-Peled , September 17, 2007 Version: 1.0 3.1 Hamiltonian Cycle Definition 3.1.1 A Hamiltonian cycle is a cycle in the graph that visits very vertex exactly once. Definition 3.1.2 An Eulerian cycle is a cycle in a graph that uses every edge exactly once. Finding Eulerian cycle can be done in linear time. Surprisingly, finding a Hamiltonian cycle is much harder. Problem: Hamiltonian Cycle Instance: A graph G . Question: Is there a Hamiltonian cycle in G ? Theorem 3.1.3 Hamiltonian Cycle is NP-C . Proof: Hamiltonian Cycle is clearly in NP . a b c d e We will show a reduction from Vertex Cover . Given a graph G and integer k we redraw G in the following way: We turn every vertex into a horizontal line segment, all of the same length. Next, we turn an edge in the original graph G into a gate , which is a vertical segment con- necting the two relevant vertices. Note, that there is a Vertex Cover in G of size k if and only if there are k horizontal lines that stabs all the gates in the resulting graph H (a line stabs a gate if one of the endpoints of the gate lies on the line). This work is licensed under the Creative Commons Attribution-Noncommercial 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 1 a b c d e Thus, computing a vertex cover in G is equivalent to comput- ing k disjoints paths through the graph G that visits all the gates. However, there is a technical problem: a path might change venues or even go back. See figure on the right. (u,v,1) (u,v,6) (u,v,2) (u,v,3) (u,v,4) (u,v,5) (v,u,1) (v,u,2) (v,u,3) (v,u,4) (v,u,5) (v,u,6) v u To overcome this problem, we will replace each gate with a component that guarantees, that if you visit all its vertices, you have to go forward and can NOT go back (or change lanes). The new component is depicted on the left. There only three possible ways to visit all the vertices of the components by paths that do not start / end inside the component, and they are the following: The proof that this is the only three possibilities is by brute force. Depicted on the right is one impossible path, that tries to backtrack by entering on the top and leaving on the bottom. Ob- serve, that there are vertices left unvisited. Which means that not all the vertices in the graph are going to be visited, because we add the constraint, that the paths start / end outside the gate-component (this condition would be enforced naturally by our final con- struction)....
View Full Document
- Fall '08