Part VII. Hamiltonian Cycle Problem
11 Hamiltonian Cycle Problem
A hamiltonian cycle in an undirected graph is a simple cycle which contains every vertex of the graph.
A graph which contains a hamiltonian cycle is called hamiltonian. A graph which does not contain a hamiltonian cycle is called nonhamiltonian.
Consider the following graph:
Note that the hamiltonian cycle path passes through every vertex.
Hamiltonian Cycle Problem
The hamiltonian cycle problem is to check whether a graph has a hamiltonian cycle..
Hamiltonian Cycle Problem is NP-Complete
We know that a problem is in class NP-Complete if: it is in NP and it is NP Hard.
Hamiltonian cycle problem is NP-complete.
Step 1: Prove that hamiltonian cycle problem is in class NP.
A set with n elements has 2n possible subsets. Then a graph with n vertices has 2n possible permutations of vertices.So an algorithm needs to check whether any one of these permutation form a hamiltonian path. If the graph is represented as an adjacency matrix, it will take n! comparisons. It has worst case time complexity Θ(2√n). (not polynomial time, but exponential time).
Let we are given a graph and a ’certificate’ telling that a sequence of vertices form a hamiltonian cycle. An algorithm can verify whether this path is hamiltonian in polynomial time.
So hamiltonian cycle problem is in class NP.
Step 2: Prove that hamiltonian cycle problem is NP-hard.
We know that a problem is NP-Hard, if every problem in NP can be reduced to this problem in polynomial time.
The approach we used is as follows:
In the previous section, we already proved that all NP problems can be reduced to SAT. Then, again we found that SAT problem can be reduced to 3-CNF-SAT problem. Again, we reduced 3-CNF-SAT problem to clique problem. again, we reduced clique problem to vertex cover problem. Then, if we can reduce vertex cover problem to hamiltonian cycle problem in polynomial time, we can say that hamiltonian cycle problem is NP-hard.
We need to reduce vertex cover problem to hamiltonian cycle problem.
|1. What is the Hamiltonian Cycle Problem in Computer Science Engineering (CSE)?
|2. Why is the Hamiltonian Cycle Problem important in CSE?
|3. What is the complexity of the Hamiltonian Cycle Problem?
|4. How can the Hamiltonian Cycle Problem be solved in practice?
|5. Can the Hamiltonian Cycle Problem be solved in polynomial time for specific cases?
Explore Courses for Computer Science Engineering (CSE) exam