Dijkstra算法和Prim算法之间的区别是什么? [英] What is the difference between Dijkstra and Prim's algorithm?

查看:1377
本文介绍了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算法之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆