15.082 & 6.855J & ESD.78J
Algorithm visualizations
Modified Label Correcting Algorithm
The Modified Label Correcting Algorithm
FIFO Version
2
5
2
3
Initialize
d(1) := 0;
d(j) := for j 1
0
6
1
3
3
1
7
-2
4
3
2
4
3
-4
3
6
LIST := {1}
2
5
2
3
In next slides: the number inside
the node will be d(j).
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
2
An Example
2
3
LIST := {{1}
}1 }3,
2
2,
3 }4 }
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
3
Generic Step
Take a node i
from LIST
3
3
1
2
4
3
-4
3
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
3
An Example
2
5
3
LIST := {{1}
} }4,
2
2,
3,
3 }5
3,
4
4}
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
4
3
Take a node i
from LIST
3
3
1
2
4
3
-4
3
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
4
An Example
2
5
3
LIST := { 4,
5 }5 }
3, 4,
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
4
3
Take a node i
from LIST
3
3
1
2
4
3
-4
3
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
5
An Example
2
5
3
LIST := { 5,
4,
5
5 }5 }
6
3,}4,
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
4
3
Take a node i
from LIST
3
3
1
2
4
3
-4
3
6
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
6
An Example
2
5
3
LIST := { 6
4,
5
5,
5 }5 }
6
3,}4,
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
4
3
Take a node i
from LIST
3
3
1
2
4
3
-4
3
6
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
7
An Example
2
5
3
LIST := { 3,
4,}4,
5
5,
}6
3
5 }5 }
6
7
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
4
3
Take a node i
from LIST
3
3
1
2
4
3
2
-4
9
3
6
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
8
An Example
2
5
3
LIST := { 7
4,}4,
5
5,
}6
3
3,
5 }5 }
6
7
3
6
0
Update(i): for each arc
(i,j) with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-2
6
4
3
Take a node i
from LIST
3
3
1
2
4
3
2
-4
9
3
6
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
9
An Example
2
3
6
3
3
1
0
-2
6
4
3
Take a node i
from LIST
5
3
LIST := { }7
4,}4,
5
5,
6
3
3,
5 }5 }
6
7
2
4
3
2
Update(i): for each arc (i,j)
with d(j) > d(i) + cij
replace d(j) by d(i) + cij.
-4
9
3
6
2
5
2
3
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
10
An Example
2
3
6
3
3
1
0
-2
6
4
3
LIST is empty.
5
3
LIST := { }7
4,}4,
5
5,
6
3
3,
5 }5 }
6
7
2
4
3
2
-4
9
3
6
The distance labels
are optimal
2
5
2
3
Here are the predecessors
0 1
6
3
3
1
-2
4
3
2
4
3
-4
7
3
6
11
MITOpenCourseWare
http://ocw.mit.edu
15.082J / 6.855J / ESD.78J Network Optimization
Fall 2010
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
© Copyright 2026 Paperzz