why negative edges cycles are allowed in bellman ford algorithms while no negative edge allowed in dijkstra algorithms?
Asked
Active
Viewed 1,570 times
0
-
You want to know why his algorithm can deal with negative edges while Dijkstra's can't? – Bruno Brant Nov 29 '10 at 18:53
1 Answers
6
Allowed? Bellman-Ford algorithm allows distinct edges with negative weights (not supported in Dijkstra algorithm), but neither algorithm "allows" negative cycles. The shortest path problem makes no sense in presence of a negative cycle, so there's no meaningful way to "allow" negative cycles in any such algorithm.
Bellman-Ford algorithm can be made to detect the presence of a negative cycle and abort execution (abort, since no correct solution exists in that case).

AnT stands with Russia
- 312,472
- 42
- 525
- 765