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 am looking for, since I need to go through all the points.
It would be great if one of you guys knew something about that...
Thanks a lot.
Julien