










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











s w v
s w v
s
d(v,k) = min{d(w,k-1) + length of edge (w,v)}, where the min is taken over all w such that (w,v) is an edge of the digraph.
d(v,k) = min{d(v,0), min{d(w,k-1) + length of edge (w,v)}}
s w v
// initialize d(*,0)
d(s,0) = 0;
d(v,0) = infinity, v != s;
// compute d(*,k), 0 < k < n
for (int k = 1; k < n; k++)
{
d(v,k) = d(v,0), 1 <= v <= n; for (each edge (u,v)) d(v,k) = min{d(v,k), d(u,k-1) + cost(u,v)}
} Docsity.com
1 2
4
3
6
5
3 7
3
(^4 ) 5
1
9
Source vertex is 1.
1
1 2
4
3
6
5
3 7
3
(^4 ) 5
1
9
1
d(v,k) p(v.k)
1 2 3 4 0
1
2 3
(^5 6) v 0 -^ -^ -^ -^ -^ -^ -^ -^ -^ -^ - k 0 3 -^7 -^ -^ - 1 - 1 - -
4
1 2
4
3
6
5
3 7
3
(^4 ) 5
1
9
1
d(v,5) p(v,5)
1 2 3 4 5
5 6 0 2 6 7 9 8 -^6 2 1 3
1 2 3 4 5 6
min{d(w,k-1) + length of edge (w,v)}}