Dijkstras Shortest Path Algorithm Home node tree Guest
- Slides: 21
Dijkstra's Shortest Path Algorithm Home node tree = { } Guest node tree = { s, 2, 3, 4, 5, 6, 7, t } 0 s 24 2 9 14 18 30 11 5 5 16 20 7 distance label 6 2 6 15 3 44 4 19 6 t 1
Dijkstra's Shortest Path Algorithm H={ } G = { s, 2, 3, 4, 5, 6, 7, t } Starting from origin 0 s 24 2 9 14 18 30 11 5 5 16 20 7 distance label 6 2 6 15 3 44 4 19 6 t 2
Dijkstra's Shortest Path Algorithm H={s} G = { 2, 3, 4, 5, 6, 7, t } decrease label by updating X 9 0 s 24 2 9 18 X 14 14 30 11 5 5 16 20 7 distance label 15 X 6 2 6 15 3 44 4 19 6 t 3
Dijkstra's Shortest Path Algorithm H={s} G = { 2, 3, 4, 5, 6, 7, t } Find the guest node with minimal label X 9 0 s 24 2 9 30 11 5 5 16 20 distance label 15 X 6 2 6 7 3 18 X 14 15 44 4 19 6 t 4
Dijkstra's Shortest Path Algorithm H = { s, 2 } G = { 3, 4, 5, 6, 7, t } Add node 2 into home node tree X 9 0 s 24 2 9 18 X 14 30 11 5 5 16 20 7 15 X 6 2 6 15 3 44 4 19 6 t 5
Dijkstra's Shortest Path Algorithm H = { s, 2 } G = { 3, 4, 5, 6, 7, t } decrease label by updating X 33 X 9 0 s 24 2 9 18 X 14 30 11 5 5 16 20 7 15 X 6 2 6 15 3 44 4 19 6 t 6
Dijkstra's Shortest Path Algorithm H = { s, 2 } G = { 3, 4, 5, 6, 7, t } X 33 X 9 0 s 24 2 9 Find guest node with minimal 18 label X 14 6 11 5 5 16 20 7 15 X 6 2 30 15 3 44 4 19 6 t 7
Dijkstra's Shortest Path Algorithm H= { s, 2, 6 } G = { 3, 4, 5, 7, t } decrease label by updating 32 Add node 6 into home node tree X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 11 5 5 16 20 7 15 X 6 2 6 15 3 44 4 19 6 t 8
Dijkstra's Shortest Path Algorithm H = { s, 2, 6 } G = { 3, 4, 5, 7, t } 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 11 5 5 16 20 7 15 X 6 2 6 15 3 44 Find guest node closest 4 19 6 t 9
Dijkstra's Shortest Path Algorithm H = { s, 2, 6, 7 } G = { 3, 4, 5, t } 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 4 19 6 t 59 X 10
Dijkstra's Shortest Path Algorithm Find guest node with minimal distance H= { s, 2, 6, 7 } G = { 3, 4, 5, t } 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 4 19 6 t 59 X 11
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 6, 7 } G = { 4, 5, t } Add node 3 into home node tree 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 4 19 6 t 51 59 X X 12
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 6, 7 } G = { 4, 5, t } 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 20 7 15 X 44 X 35 X 5 5 6 2 6 15 3 Find node with minimal distance label 44 11 16 4 19 6 t 51 59 X X 13
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 5, 6, 7 } G = { 4, t } 32 Add node 5 into home node tree X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 45 X 4 19 6 t 50 51 X 59 X X 14
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 5, 6, 7 } G = { 4, t } 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 45 X 4 19 Find node with 6 minimal distance 16 label 20 7 6 2 6 15 3 44 t 50 51 X 59 X X 15
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 4, 5, 6, 7 } G={t} 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 45 X 4 19 6 t 50 51 X 59 X X 16
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 4, 5, 6, 7 } G={t} 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 Find node with minimal distance label 45 X 4 19 6 t 50 51 X 59 X X 17
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 4, 5, 6, 7, t } G={} 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 45 X 4 19 6 t 50 51 X 59 X X 18
Dijkstra's Shortest Path Algorithm H = { s, 2, 3, 4, 5, 6, 7, t } G={} Backtracking for finding shortest path 32 X 33 X X 9 0 s 24 2 9 18 X 14 30 44 X 35 X 5 5 15 X 11 16 20 7 6 2 6 15 3 44 45 X 4 19 6 t 50 51 X 59 X X 19
Label Setting Algorithm (Computer Science Notation) S : = ; T : = N; //setup two node sets, S: Home, T: Guest d(i) : = ∞ for i N; d(s) : = 0; //initialize distance label p(s) : = 0; //initialize predecessor while S ≠N do // perform the following operation until all the nodes are permanently labeled begin (node selection, also called FINDMIN) let i ∈T be a node for which d(i) = min {d(j) : j ∈ T}; // select the node i with the minimum label in the temporarily labeled set S : = S {i}; // add node i into permanently labeled set T: = T –{i}; // remove node i from temporarily labeled set Update(i) // update distance labels for all outgoing arcs from i end; 20
A Generic Shortest Path Algorithm (Operations Research Notation) Algorithm LABEL CORRECTING; begin n n d(1) : = 0 and Pred(1) : = ø; d(j) : = for each j N – {1}; while some arc (i, j) satisfies d(j) > d(i) + cij do begin d(j) : = d(i) + cij; – Pred(j) : = i; – end; n 21
- Dijkstra's shortest path algorithm pseudocode
- Shortest path definition
- Shortest path in discrete mathematics
- Widest path algorithm
- Mincost flow
- Augmenting path algorithm
- Shortest path algorithm in mapreduce
- Single-source shortest paths
- Minimum spanning tree shortest path
- Reference node and non reference node
- Reference node and non reference node
- Constructive interference
- Typedef struct node node
- Russell-saunders coupling
- Struct node int data struct node* next
- Shortest path to get food
- Shortest path linear programming
- Shortest path problem adalah
- Tramp steamer problem
- Dijkstra algorithm
- Shortest path from source to destination in weighted graph
- Single source shortest path in c