Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shortest Path Algorithm l(v) - label of the vertex v 1. Set l(u 0 ) = 0, l(v) =  for v  u 0, S 0 ={u 0 } and i = 0. 2. For each v not in S i, replace.

Similar presentations


Presentation on theme: "Shortest Path Algorithm l(v) - label of the vertex v 1. Set l(u 0 ) = 0, l(v) =  for v  u 0, S 0 ={u 0 } and i = 0. 2. For each v not in S i, replace."— Presentation transcript:

1 Shortest Path Algorithm l(v) - label of the vertex v 1. Set l(u 0 ) = 0, l(v) =  for v  u 0, S 0 ={u 0 } and i = 0. 2. For each v not in S i, replace l(v) by min{l(v), l(u i ) + w(u i,v)}. Compute the minimum of the vertices not in S i and let u i+1 denote a vertex for which this minimum is attained. Set S i  {u i+1 }. 3. If i is one less than the number of vertices in a graph, stop. If i < v -1, replace i by i++ go to step 2.

2 b a f e d c w(a,b) = 21, w(a,c) = 7, w(a,e) = 6, w(a,f) =5 w(b,c) =16, w(b,d) = 8, w(b,f) = 4, w(c,d) = 3, w(c,e) = 12 w(d,e) = 9, w(d,f) = 14 w(e,f) = 2

3 481216 3 2 1 7 6 5 1115 1014 913 w(1,2) = 1, w(1,5) = 3, w(2,3) = 2, w(2,5) = 1, w(2,6) = 6, w(2,7) = 2, w(3,4) = 3, w(3,7) = 5, w(3,8) = 1, w(4,8) = 2, w(5,6) = 3, w(5,9) = 2, w(5,10) = 1, w(6,7) = 1, w(6,10) = 1, w(7,8) = 1, w(7,10) = 1, w(7,11) = 3, w(7,12) = 2, w(8,12) = 3, w(9,10) = 2, w(9,13) = 4, w(9,14) = 5, w(10,11) = 2, w(10,14) = 1, w(10,15) = 5, w(11,12) = 2, w(11,15) = 2, w(11,16) = 3, w(12,16) = 1, w(13,14) = 2, w(14,15) = 1, w(15,16) = 2


Download ppt "Shortest Path Algorithm l(v) - label of the vertex v 1. Set l(u 0 ) = 0, l(v) =  for v  u 0, S 0 ={u 0 } and i = 0. 2. For each v not in S i, replace."

Similar presentations


Ads by Google