Dijkstra's shortest path algorithm on weighted graph