I learned that even though seemingly similar, Eulerian path can be solved in linear time while Hamiltonian path problem is NP-complete. I wonder what is the reason that underlies this difference? I don’t know too much graph theory so probably won’t understand well a rigorous proof, but some jargons should be fine.
I learned that even though seemingly similar, Eulerian path can be solved in linear
Share
Basically, the Euler problem can be solved with dynamic programming, and the Hamilton problem can’t.
This means that if you have a subset of your graph and find a valid circular path through it, you can combined this partial solution with other partial solutions and find a globally valid path. That isn’t so for the optimal path: even after you have found the optimal path through a small part of a graph, this may very well not be a part of the globally optimal path (and in fact, it usually isn’t). Informally, the optimal path through a large graph depends on the exact values in all other parts of the graph, and therefore no one has ever found a way to use “divide and conquer” correctly on the problem.