Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Bellman-Ford Algorithm
Bookmark
Input
4 Nodes Simple
5 Nodes (with negative edge)
Custom
graph
=
{"1":[["2",4],["3",3]],"2":[["3",-2],["4",4]],"3":[["4",2]],"4":[]}
,
source
=
1
Bellman-Ford Algorithm (source: 1)
Initializing...
4
3
-2
4
2
1
2
3
4
0
∞
∞
∞
Distances:
1
0
2
∞
3
∞
4
∞
Algorithm Info:
Total iterations needed: V - 1 = 3
Time Complexity: O(V * E)
Legend:
Unprocessed
Source/Active
Checking
Relaxed
algo
master
.
io
Step:
Initialize distances: source "1" = 0, all others = ∞
0 / 28
Input
4 Nodes Simple
5 Nodes (with negative edge)
Custom
graph
=
{"1":[["2",4],["3",3]],"2":[["3",-2],["4",4]],"3":[["4",2]],"4":[]}
,
source
=
1
0 / 28
Bellman-Ford Algorithm (source: 1)
Initializing...
4
3
-2
4
2
1
2
3
4
0
∞
∞
∞
Distances:
1
0
2
∞
3
∞
4
∞
Algorithm Info:
Total iterations needed: V - 1 = 3
Time Complexity: O(V * E)
Legend:
Unprocessed
Source/Active
Checking
Relaxed
algo
master
.
io
Step:
Initialize distances: source "1" = 0, all others = ∞