简体   繁体   English

我如何 go 关于解决克鲁斯卡尔工会

[英]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.

相关问题 如何在没有反复试验的情况下解决此递归问题 - How should I go about solving this recursion without trial and error 我将如何 go 关于解决“找到多重定义的符号” - How would I go about solving the “multiply defined symbols found” 我如何 go 关于这个程序? - How do I go about this program? 你会怎么解决这个问题? 老式学生/课程/学校代码。 这是我的方法: - How would you go about solving this? Old-Fashion Student/Course/School Code. Here's my approach: 如何使用联合查找,最小堆,克鲁斯卡尔算法和排序算法来创建最小成本生成树? (C ++) - How to use union-find, minheap, Kruskal's, and a sort algorithm to create a minimum cost spanning tree? (C++) 如何编辑结构数组中的变量? - How do I go about editing the variables in a struct array? 我如何去实现一个奇怪的“类”符号 - How do I go about implementing a strange "class" notation 如何将第三方库添加到QtCreator? - How do I go about adding a third party library to QtCreator? 我如何 go 关于调用此模板 function? - How do I go about calling this template function? 如何创建此标记联合的实例? 有关已删除构造函数的编译器错误 - How do I create an instance of this tagged union? Compiler errors about deleted constructor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM