Dijkstra算法和Prim算法之间的区别是什么?

编程入门 行业动态 更新时间:2024-10-18 14:19:17
本文介绍了Dijkstra算法和Prim算法之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何一个可以告诉我 Dijkstra的和的Prim's 算法?我知道每一种算法做。但他们看起来是一样的我。 Dijkstra算法存储的,而Prim算法存储最小成本边缘至多一个最小成本边缘的总和。这难道不是一样吗?

Can any one tell me the difference between Dijkstra's and Prim's algorithms? I know what each of the algorithms do. But they look the same to me. Dijkstra's algorithm stores a summation of minimum cost edges whereas Prim's algorithm stores at most one minimum cost edge. Isn't this the same?

推荐答案

Dijsktra的算法找到从节点i到所有节点的最小距离 (指定I)。所以,作为回报,你从节点我得到的最小距离树。

Dijsktra's algorithm finds the minimum distance from node i to all nodes (you specify i). So in return you get the minimum distance tree from node i.

Prims算法,可以让你在最短企业跨越式树对于一个给定图。连接所有节点,而所有费用的总和是最小的可能的树

Prims algorithm gets you the minimum spaning tree for a given graph. A tree that connects all nodes while the sum of all costs is the minimum possible.

因此​​,与Dijkstra算法的你可以从所选择的节点到任何其他以最小的成本,你没有得到这个与普里姆的

So with Dijkstra you can go from the selected node to any other with the minimum cost, you don't get this with Prim's

更多推荐

Dijkstra算法和Prim算法之间的区别是什么?

本文发布于:2023-11-29 16:57:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647018.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:算法   区别   Dijkstra   Prim

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!