If there exists a weighted graph G, and all weights are 1, what would Dijkstra's algorithm return as the shortest paths from a given node?
If there exists a weighted graph G, and all weights are 1, what would Dijkstra's algorithm return as the shortest paths from a given node?
A correct implementation of Dijkstra's algorithm will return, for every node, the 'predecessor' node. If you follow the predecessor nodes in sequence you will get back to the given node on a path that goes over the fewest number of connections.