Originally Posted by
nuzzle
The problem is to find a Hamiltonian Circuit in a graph, that is a path which visits every point (vertice) once. This is an NP-hard problem just like the TSP.
I'm not sure whether there are polynominal time algorithms available for restricted problems. But if not all points are connected this at least should reduce the running time in practice.
The most straightforward approach is recursion I think. You start at any point and from it you visit every available point one by one. This is then repeated recursively for each point you reach. You must keep track of the current path because you need to know which points you've already visited. If you cannot go anywhere from a point the recursion backtracks (rewinds to the previously visited point and continues there). When all points are in the current path and you can reach the starting point from where you are, you've found a Hamiltonian path.