Dijkstra's Algorithm correctly implemented.