Bellman–Ford algorithm: Difference between revisions

Content deleted Content added
Andris (talk | contribs)
merged the information from a duplicate page
Andris (talk | contribs)
+comments to program
Line 16:
for each edge (u,r) in G do
if Distance(r) > Distance(u) + w(u,r);
return false; //This means that the graph contains a cycle of negative weight and the shortest paths are not well defined
return false;
return true; //Lengths of shortest paths are in Distance array