From 1a8ce6b2482ccef2f00cf4663f91928d00a2fbc7 Mon Sep 17 00:00:00 2001 From: Aniket Gargya Date: Sun, 16 Apr 2023 19:48:33 -0500 Subject: [PATCH] :pencil2: change = to + in bellman ford algorithm --- src/lecture19/code/bellman-ford-negative-cycle-detection.sudo | 2 +- src/lecture19/code/bellman-ford.sudo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lecture19/code/bellman-ford-negative-cycle-detection.sudo b/src/lecture19/code/bellman-ford-negative-cycle-detection.sudo index 4839018..1ee0244 100644 --- a/src/lecture19/code/bellman-ford-negative-cycle-detection.sudo +++ b/src/lecture19/code/bellman-ford-negative-cycle-detection.sudo @@ -5,7 +5,7 @@ d(s) = 0 for k = 1 to n - 1 do for each v in V do for each edge (u, v) in In(v) do - d(v) = min(d(v), d(u) = l(u, v)) + d(v) = min(d(v), d(u) + l(u, v)) for each v in V do for each edge (u, v) in In(v) do diff --git a/src/lecture19/code/bellman-ford.sudo b/src/lecture19/code/bellman-ford.sudo index 2f50715..a0e303c 100644 --- a/src/lecture19/code/bellman-ford.sudo +++ b/src/lecture19/code/bellman-ford.sudo @@ -5,7 +5,7 @@ d(s) = 0 for k = 1 to n - 1 do for each v in V do for each edge (u, v) in In(v) do - d(v) = min(d(v), d(u) = l(u, v)) + d(v) = min(d(v), d(u) + l(u, v)) for each v in V do dist(s, v) = d(v)