Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Multistage Graph Problem : Forward Method

V1 V2 V3 V4 V5

15
B G
5
5 7
E 8
3
4 3
A C 4 H J
8
7 F 6
6
4
D I
cost(4,G) = c(G,J) = 7
cost(4,H) = c(H,J) = 3
cost(4,I) = c(I,J) = 6
cost(3,E) = c(E,H) + cost(4,H) = 8 + 3 = 11
cost(3,F) = min {c(F,H) + cost(4,H) | c(F,H) + cost(4,I)}
= min { 8 + 3 | 6 + 6} = 11
cost(2,B) = min { c(B, G) + cost(4,G) | c(B, E) + cost(3,E)}
= min { 15 + 7 | 5 + 11 } = 16
cost(2,C) = min { c(C,E) + cost(3,E) | c(C,F) + cost(3,F)}
= min {3 + 11 | 4 + 11} = 14
cost(2,D) = c(D, F) + cost(3,F) = 4 + 11 = 15
cost(1,A) = min {c(A,B) + cost(2,B) | c(A,C) + cost(2,C) |
c(A,D) + cost(2,D)}
= min { 5 + 16 | 4 + 14 | 7 + 14} = 18

Shortest path is A - C - E - H - I with distance 18

You might also like