Dijkstra and Bellman-Ford-Moore's algorithms