retagged by
367 views
0 votes
0 votes
difference between Bellmann ford and dijkstra's algorithm for -ve weight cycle graph
retagged by

1 Answer

0 votes
0 votes
in dijkstra

if there is a negative weight cycle then dijkstra will not work  .

if there is negative edge in the graph but not negative weight cycle then dijkstra may give the correct result

now come to bellman

if there is negative edge in the graph but not negative weight cycle then the bellman give the correct result

if there is a negative weight cycle then bellman ford say that cannot find the shortest path to that vertices because of negative weight cycle