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 ?