http://www.perlmonks.org?node_id=1067997


in reply to Travelling problem

I know of no practical way to solve the TS problem that doesn’t involve recursion.   It could actually be fairly simple, and wouldn’t necessarily occupy too much CPU time, since all adjacent edges which lead to an already-visited city would be immediately disqualified.   If the recursion successfully reached a depth equal to the number of cities, you know that the problem has been solved.   (It is the “shortest path” bugaboo, not present here, that makes TS computationally intractable.)