Nama : Bagas Pamungkas
NRP : 04211640000032
Class : Riset Operasi A
DIJKSTRA ALGORITHM EXAMPLE
A man who is living in Sidoarjo is going to ITS to attend Research Operation class. There are many ways
to get there,but the man is confused which way should the man takes. Help the man find the shortest
way to get to ITS by using dijkstra algorithm.
8.9
5
2
7.4
8.7 9.8 7
1 8.6
3.6 3.4 2.3
3 5,2 6 9
4 8 8.3
11 10
11 0.85
2.1
4.8 11
7
1.9
12
Iteration #1
Node Label Status
1 [0 , -- ] Permanent
2 [0 + 7.4 , 1] Temporary
3 [0 + 8.6 , 1] Temporary
Iterarion #2
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [7.4 + 8.7 , 2] = [16.1 , 2] Temporary
4 [7.4 + 8.9 , 2] = [16.3 , 2] Temporary
Iteration #3
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [16.1 , 2] Permanent
4 [16.1 + 9.8 , 4] = [25.9 , 4] Temporary
5 [16.1 + 3.6 , 4] = [19.7 , 4] Temporary
Iteration #4
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [16.1 , 2] Permanent
4 [19.7 , 4] Permanent
5 [19.7 + 3.4 , 6] = [23.1 , 6] Temporary
6 [19.7 + 11 , 6] = [30.7 , 6] Temporary
Iterarion #5
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [16.1 , 2] Permanent
4 [19.7 , 4] Permanent
5 [23.1 , 6] Permanent
6 [23.1 + 2.3 , 8] = [25.9 , 8] Temporary
Iteration #6
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [16.1 , 2] Permanent
4 [19.7 , 4] Permanent
5 [23.1 , 6] Permanent
6 [25.9 , 8] Permanent
7 [25.9 + 8.3 , 9] = [34.2 , 9] Temporary
Iteration #7
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [16.1 , 2] Permanent
4 [19.7 , 4] Permanent
5 [23.1 , 6] Permanent
6 [25.9 , 8] Permanent
7 [34.2 , 9] Permanent
8 [34.2 + 0.85 , 10] = [35.05 , 10] Temporary
9 [34.2 + 2.1 , 10] = [36.3 , 10] Temporary
Iteration #8
Node Label Status
1 [0 , -- ] Permanent
2 [7.4 , 1] Permanent
3 [16.1 , 2] Permanent
4 [19.7 , 4] Permanent
5 [23.1 , 6] Permanent
6 [25.9 , 8] Permanent
7 [34.2 , 9] Permanent
8 [35.05 , 10] Permanent
9 [36.95 , 11] Permanent
From the calculation above, the shortest way to get to ITS (node 12) from home (node 1) is : 1 – 2 –
4 – 6 – 8 – 9 – 10 – 11 – 12