0

I need to show that given undirected graph G, Hamiltonian path and Hamiltonian cycle are polynomial time reducible to each other. Here is my reduction, is this correct?

For Cycle to Path For a vertex v belonging to V, add a vertex v’ and for all e(v,u) add edge e(v’ ,u). Now if there is a Hamiltonian Path from v to v’, then there is a Hamiltonian cycle for v.

For Path to cycle For a vertices s and t, for all edges e(t,u) add an edge e(s,u) (if this edge did not existed) and for all edges e(s,u) add an endge (t,u) (if this edge did not existed). Finally add an edge e(s,t). Now if there is a Hamiltonian cycle for s or t, then there is a Hamiltonian path from s to t.

Are there reductions correct ? also is this enough to show that these two problems are polynomial time reducible to each other ?

Saik
  • 993
  • 1
  • 16
  • 40
  • The second reduction is not obvious at all. Explain what you do with the cycle to obtain a path from s to t. – n. m. could be an AI Dec 02 '15 at 05:30
  • Well my thinking was to sort of collapse s and t into one vertex and if there is a cycle for this vertex then there is a path for original graph. I am not sure if this is a correct reduction, but I tried it on few examples and it seems correct. – Saik Dec 02 '15 at 05:52
  • A cycle is not guaranteed to pass through any of the added edges. If you want to collapse s and t into a new vertex, add a new vertex. – n. m. could be an AI Dec 02 '15 at 06:01
  • So for path to cycle reduction. If I add a new vertex v and add edges e(v,t) e(v,s) the cycle for this v will guarantee a path from s to t ? – Saik Dec 02 '15 at 06:18
  • Yes it will. A Hamiltonian cycle by definition passes through all vertices so you don't need to say "a cycle for v". – n. m. could be an AI Dec 02 '15 at 06:23
  • You can also try to find an easier cycle to path reduction. There is one that adds no new edges or vertices to the graph. – n. m. could be an AI Dec 02 '15 at 06:28
  • n.m. any clue where can I find info about this easier reduction ? – Saik Dec 02 '15 at 07:15
  • Come up with it yourself... btw, your reduction doesn't work for a graph with 2 vertices and 1 edge. Not a big problem, this is a special case that needs to be checked separately. – n. m. could be an AI Dec 02 '15 at 07:24

0 Answers0