Download presentation
Presentation is loading. Please wait.
Published byJeremy Morgan Modified over 9 years ago
1
Dijkstra animation
2
Dijksta’s Algorithm (Shortest Path Between 2 Nodes) 2 Phases:initialization;iteration Initialization: 1. Included:(Boolean) 2. Distance:(Weight) initialize to 0 if START weight if an edge from START to index ∞ if no edge (not adjacent) 3. Path:(node) Contains immediate predecessor initialize to: START if adjacent undefined if not adjacent
3
Iteration: repeat find node j with smallest distance, not already included; for each R not included and adjacent to J if distance[j]+edgeweight(J,R)<distance[R] then distance[R]:=distance[J]+edgeweight(J,R); Path[R]:=J; endif; until destination node is included; Dijkstra’s Algorithm
4
t f f - A A A - - ft t t B B ft - 4 2 5 ∞ ∞ F ft 10 8 9 Dijkstra Give the shortest path tree for node A for this graph using Dijkstra’s shortest path algorithm. Show your work with the 3 arrays given and draw the resultant shortest path tree with edge weights included.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.