23.6 Case Study: Dijkstra's Algorithm
- A (min) PQ is used to represent the list of possible
destinations with the relative cost of traveling to them
- Build a resultant map shortest of names and distances
- Place the source on the queue, w/distance 0
- Loop while the PQ is not empty:
- Pop element
- If city already visited (in shortest), goto 1
- Place city and cost in shortest
- For each adjacent node in cities (loop from
lower_bound to upper_bound:
- Add current distance to relative distance, add new entry to
PQ
prev
|top
|next