Reduce Hamiltonian Path Decision Problem To Hamiltonian Cycle Decision Problem

740 Views Asked by At

Person A requires that he determine whether or not a particular graph G = (V,E) has a Hamiltonian path from vertex a to vertex b.

His colleague Person B has implemented a function that takes an undirected graph G = (V,E) and returns true iff G has a hamiltonian cycle. Person B said you can use my function to get your answer, just make sure to add an edge that connects a with b.

Give an example that shows that the answer returned by Person B's function might not coincide with Person A 's original problem.

In other words, simply adding an edge between a and b is insufficient for reducing HP to HC decision problem.