You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/graph/bellman_ford.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,7 +201,7 @@ Due to the presence of a negative cycle, for $n$ iterations of the algorithm, th
201
201
d[e.b] = max(-INF, d[e.a] + e.cost);
202
202
```
203
203
204
-
The above implementation looks for a negative cycle reachable from some starting vertex $v$; however, the algorithm can be modified to justlooking for any negative cycle in the graph. For this we need to put all the distance $d[i]$ to zero and not infinity — as if we are looking for the shortest path from all vertices simultaneously; the validity of the detection of a negative cycle is not affected.
204
+
The above implementation looks for a negative cycle reachable from some starting vertex $v$; however, the algorithm can be modified to justlook for any negative cycle in the graph. For this we need to put all the distance $d[i]$ to zero and not infinity — as if we are looking for the shortest path from all vertices simultaneously; the validity of the detection of a negative cycle is not affected.
205
205
206
206
For more on this topic — see separate article,[Finding a negative cycle in the graph](finding-negative-cycle-in-graph.md).