Download presentation
Presentation is loading. Please wait.
Published byMiriam Master Modified over 9 years ago
1
DIJKSTRA’s Algorithm
2
Definition fwd search Find the shortest paths from a given SOURCE node to ALL other nodes, by developing the paths in order of increasing path length. The alg. Proceeds in stages. N = set of nodes in the network; S = sourse node; M set of nodes so far incorporated by the alg l(i,j)= link cost from node i to j;l(i,i)=0; l(i,j)= if the two nodes are not directly connected; l(i,j)>0 if they are directly connected; C1(n) = least-cost paths from S to n
3
FWD. Search Algorithm 1.Set M={S}; for each node n N-S, set C1(n)=l(S,n); 2. Find W N-M so that C1(w) in minimum, add W to M. Set C1(n)= MIN C1(n) and C1(w)+l(w,n) 3. Repeat 2. until M=N
4
Definition bwd search Find the shortest paths from a given DESTINATION node from ALL other nodes. N = set of nodes in the network; D = destination node; M set of nodes so far incorporated by the alg l(i,j)= link cost from node i to j;l(i,i)=0; l(i,j)= if the two nodes are not directly connected; l(i,j)>0 if they are directly connected; C2(n) = least-cost paths from D to n
6
BWD. Search Algorithm 1.Set C2(D)=0; for each node n N-D set C2(n)= ; 2. For each node n N-D set C2(n)= MIN C2(n) and C2(w)+l(n,w) (w N) 3. Repeat 2. until no changes in C2
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.