Quote Originally Posted by MK27 View Post
Again, always pick the closest (unvisited) one. Use a function that will compute the distance to all remaining points, eliminate the current one from an array, and proceed.
BTW, this is called Dijkstra's algorithm; you can find a fairly good explanation at http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm. Unfortunately, it doesn't tell you much about its efficiency except for its asymptotic runtime. Without going into too much detail (read this book), let me say that Dijkstra is optimal for solving single-source shortest path problems with respect to graphs with non-negative edge-weights.

Greets,
Philip