L18-shortestPaths

v 1 4 do for each e x y e 5 do dy min dy wx

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ⌥ shorti 1,y = min ⌥ shorti,y w (x, y ) + shorti 1,x do shorti,y = min ⇧ ⌃ w(x, y ) + shorti 1,x bellman-ford(G, s) 1 ds ⇥ 0 2 ⇧v ⌅ V {s}, dv ⇥ ⇤ 3 for i = 1, . . . , V 1 4 do for each e = (x, y ) ⌅ E ⇥ 5 do dy ⇥ min dy , w(x, y ) + dx ⌃ ⌦ 5 do shorti,y = min shorti,y ⌥ w(x, y ) + shorti running time bellman-ford(G, s) 1 ds ⇥ 0 2 ⇧v ⌅ V {s}, dv ⇥ ⇤ 3 for i = 1, . . . , V 1 4 do for each e = (x, y ) ⌅ E ⇥ 5 do dy ⇥ min dy , w(x, y ) + dx 1,x negative cycles? s 2 3 1 -5 s a b t 0 t negative cycles? s 2 3 1 -5 s 0 0 0 0 a 2 2 2 1 5 5 5 6 6 b t t applications of bf image: cheswick et al b 8 g 3 -12 c 2 9 e -4 what happens when B changes... 5 7 10 a d i 5 -4 -3 1 f 6 h a b c d0 e f g h i 0 1 8 0 7 5 5 2 bf(G,d) 3 4 5 6 7 distance vector image: hurricane electric all-pairs shortest path a b 1 2 h 2 5 7 -4 10 -1 k 3 i j -8 ashorti,j,k = ashorti,j,k = j i k ashorti,j,k = ashorti,j,k = 8 < wi,j : min ashorti,j,k-1 ashorti,k,k-1 + ashortk,j,k-1 9 k=0 = k 1; floyd-warshall(G,W)...
View Full Document

Ask a homework question - tutors are online