1. 两个list的nodes,searched and unsearched
2. start from a source node.
3. go to its neighbors, calculate their distances to the source node.
4. Use a priority queue or something, always find the node with shortest distance to the source node.
5. Repeat the steps from 3-4, until no nodes exist in the priority queue.
https://www.geeksforgeeks.org/dijkstras-shortest-path-algorithm-greedy-algo-7/
https://leetcode.com/problems/network-delay-time/submissions/
网友评论