任何一个可以告诉我 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算法之间的区别是什么?
发布评论