Dijkstra shortest path algorithm.