Lab Graph
Lab Graph
WEIGHT
HEAD 0 OR 1
init 1 2 3 4 5
active a b c f d e
vertex
a 0
b ∞ 7
c ∞ 9 9
d ∞ ∞ 22 20 20
e ∞ ∞ ∞ ∞ ∞ 26
f ∞ 14 14 11
Bellman-Ford’s algorithm trace to find the shortest path from its start vertex to its
end vertex directed graph (accept -ve value):
Iteration init 1 2 3
Source 0
A ∞ 41
B ∞ 6
C ∞ 7 4
D ∞ 7 6
Dijkstra Algorithm’s pseudocode to find the shortest path: