Nearly identical to Prim's MST algorithm:
In Dijkstra, distance to ``outside'' node is the total distance from source instead of just the minimum length edge from the current tree.