知识卡片
两算法键值目标不同
两者都用最小优先队列逐点扩张,但 Dijkstra 的键表示源点到顶点的最短路径估计,Prim 的键表示新顶点接入当前树的最轻单边。
目标分别是路径权与整棵树总权。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第22章 单源最短路径 · 查看原书依据
Dijkstra’s algorithm is like Prim’s algorithm in that both algorithms use a min-priority queue to find the “lightest” vertex outside a given set (the set S in Dijkstra’s algorithm and the tree being grown in Prim’s algorithm), add this vertex into the set, and adjust the weights of the remaining vertices outside the set accordingly.
参考来源
- 位置:《算法导论(第4版)》第22章《单源最短路径》(OEBPS/chapter022.xhtml,文本字符[40000,45000))。
- 结论依据:第22.3节直接比较两算法队列扩张;本章Dijkstra以d估计为键,第21章Prim的v.key则是连接当前树的最轻单边。
- 原始内容:Dijkstra’s algorithm is like Prim’s algorithm in that both algorithms use a min-priority queue to find the “lightest” vertex outside a given set (the set S in Dijkstra’s algorithm and the tree being grown in Prim’s algorithm), add this vertex into the set, and adjust the weights of the remaining vertices outside the set accordingly.
- 跨章原文(第21章文本字符[15000,20000)):For each vertex v , the attribute v.key is the minimum weight of any edge connecting v to a vertex in the tree, where by convention, v.key = ∞ if there is no such edge.
- 本章原文(文本字符[30000,35000)):The procedure D IJKSTRA replaces the first-in, first-out queue of breadth-first search by a min-priority queue Q of vertices, keyed by their d values.