简体   繁体   English

查找循环图的最小加权生成树

[英]Find a minimum weighted spanning tree of the Cycle graph

在此处输入图片说明

I'm trying to solve the problem presented above and here is my attempt: 我正在尝试解决上述问题,这是我的尝试:

Attempt: We can apply Dijkstra's shortest path algorithm instead of using Prim's and Kruskal's algorithms to find a MST as Dijkstra will visit all the nodes in the smallest weighted distance. 尝试:我们可以应用Dijkstra的最短路径算法,而不是使用Prim和Kruskal的算法来查找MST,因为Dijkstra将访问最小加权距离的所有节点。 Complexity: For G = (V,E), O(E log(V)) 复杂度:对于G =(V,E),O(E log(V))

Questions: 问题:

(1) Is my approach correct ? (1)我的方法正确吗? (2) Is it the most efficient answer to the question ? (2)这是最有效的答案吗?

If i'm completely wrong, I would appreciate a correct and efficient solution. 如果我完全错了,我将感谢您提供一种正确有效的解决方案。

A cycle graph contains no edges other than those connecting the vertices in the cycle. 循环图除了连接循环中的顶点的边外,不包含其他边。 So what we can do is iterate through all N edges and eliminate the maximum weighted edge forming a spanning tree of N - 1 edges containing the minimum sum of edges, forming a Minimum Spanning Tree. 因此,我们可以做的是遍历所有N个边并消除最大加权边,从而形成N-1个边的生成树,其中包含最小边的总和,从而形成最小生成树。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM