patternMinor
Is it possible to produce different shortest path trees using bellman ford and Dijkstra algorithm?
Viewed 0 times
pathbellmanproducedijkstrashortesttreesdifferentpossiblefordalgorithm
Problem
Given a graph G=(V,E) with positive edges weights, Is it possible to produce different shortest path trees for the Bellman-Ford algorithm and Dijkstra's algorithm?
Solution
If there are multiple shortest paths (equal distances), you could get different results even between two runs of Bellman Ford, if for instance, the two runs consider edges in different orders. But, for any graph with unique shortest paths, they obviously must both return the unique answer.
Context
StackExchange Computer Science Q#60510, answer score: 5
Revisions (0)
No revisions yet.