diff options
Diffstat (limited to 'graph/bellmannFord.cpp')
| -rw-r--r-- | graph/bellmannFord.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/graph/bellmannFord.cpp b/graph/bellmannFord.cpp index 730cad2..785a42d 100644 --- a/graph/bellmannFord.cpp +++ b/graph/bellmannFord.cpp @@ -4,7 +4,7 @@ void bellmannFord(int n, vector<edge> edges, int start) { for (int i = 1; i < n; i++) { for (edge& e : edges) { - if (dist[e.from] != INF && + if (dist[e.from] != INF && dist[e.from] + e.cost < dist[e.to]) { dist[e.to] = dist[e.from] + e.cost; parent[e.to] = e.from; |
