Dijkstra's algorithm for shortest path in directed graph.