



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Detailed informtion about Dijkstra's Shortest Path algorithm, Introduction, Algorithm, Dijsktra’s Pseudo code, Dijkstra’s algorithm: example, initial node.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 7 8 Loop 9 find w not in N' such that D(w) is a minimum 10 add w to N' 11 update D(v) for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N'
Step 0 1 2 3 4 5
D(A),p(A) 3,B D(C),p(C) 5,B 4,A D(D),p(D) D(E),p(E) ∞ ∞ D(F),p(F) ∞ ∞ ∞ 15,D 9,E ∞ ∞ 6,C 8,C 8,C