How do I go about solving for Kruskal's union
I have trie开发者_如何学God going through the graph and changing every instance of some ID into a newer ID and it still led to a cycle. What is plan to solve for an acyclic solution?
You should never get cycles when adding new edges in the Kruskal's algorithm. 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
精彩评论