Search code examples
algorithmtreedijkstrashortest-pathbellman-ford

Restrictions on Dijkstra, Bellman ford, and topoloical Shortest path algorithms?


What exact restrictions/conditions are there to be able to use either of these 3 SPT algorithms on graphs in order to compute the shortest paths?


Solution

  • Dijkstra's algorithm requires the edge lengths to be nonnegative, while Bellman-Ford only requires the nonexistence of cycles of negative length.