[英]How do I go about solving for Kruskal's union
I have tried going through the graph and changing every instance of some ID into a newer ID and it still led to a cycle.我尝试浏览图表并将某个 ID 的每个实例更改为更新的 ID,但它仍然导致了一个循环。 What is plan to solve for an acyclic solution?解决非循环解决方案的计划是什么?
You should never get cycles when adding new edges in the Kruskal's algorithm.在 Kruskal 算法中添加新边时,您永远不应该得到循环。 If you are adding an edge that connects the same component to itself, you skip that edge.如果要添加将同一组件连接到自身的边,则跳过该边。 You will never get cycles because it won't be a minimal spanning tree你永远不会得到循环,因为它不是最小生成树
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.