A Hamiltonian Cycle is a tour that visits each vertex in a graph exactly once.
Input: An unweighted
graph G.
Output: Does there
exist a simple tour that visits each vertex in G without
repetition?
This can be reduced into the Traveling salesperson problem. The two problems are very similar: each asks for a tour that visits each vertex once. The primary difference is that the TSP is on a weighted graph. Here is the reduction:
Hamiltonian Cycle(G= (V,E))
Construct
a complete weighted graph G' = (V',E') where V' = V
n
= |V|
for
i = 1 to n do
for j = 1 to n do, if (i,j) exists in E then w(i,j) = 1 else w(i,j) = 2
Return
answer to TSP(G',n)
TSP
Input :
A weighted graph G and a value n
Output: Does a
simple tour exist in G so every vertex is visited exactly once and
the
sum of the edges traveled is equal to n.
In order to get a cost
n in the TSP problem, then the weight each edge in G' traveled must equal
1. This mean that the edge is in G and a Hamiltonian Cycle exists.
The answer to the the
two problems will be identical.
Thank You....
Yes, I still haven't turned
in my programming project.......