# Algorithm for the shortest edge-disjoint path between all the points of a 2D cloud

Hi all!

I have an array of points with their coordinates X and Y. Each point represents a bus stop. I need to sort the points in a sequence by giving them sequence numbers, so that the path from the first to the last is the shortest.

For a convention, let's call the array "points", so we access and write by calling

point(i) for the point
point(i)(x) and point(i)(y) for the coordinates
point(n) is the sequence number.


It's also possible to use the for each loop:

for each point in points
point(x)
point(y)
point(n)


The sequence needs to go through all the points of the array. I searched a lot on the internet, and the only thing I could find is Dijkstra's algorithm, which is not exactly what I look for, since I need to go through all the points.

It would be great if one of you guys knew something about that...

Thank's a lot.

Julien

-
I added the graph theory tag. – Tony Huynh May 23 '10 at 22:54

## 1 Answer

If you only care about the length of the path between the first and last bus stops, then it looks like you are trying to solve the shortest Hamiltonian path problem (HPP). This is related to the more widely studied traveling salesman problem, see TSP. Since your points actually lie in the plane, you are considering the special case of the Euclidean Hamiltonian path problem. For Euclidean TSP, there is a polynomial-time approximation scheme, so I am guessing that the same is true for Euclidean HPP. Also, there are some heuristics based on neural networks, that appear to work well. See this paper.

-
Thank's, you're so helpful ! (I can't vote up since i don't have 15 reputation...) – Julien May 24 '10 at 0:12