Union/Find 数据结构如何应用于 Kruskal 算法?

发布于 2024-10-05 02:10:16 字数 290 浏览 0 评论 0原文

http://en.wikipedia.org/wiki/Disjoint_sets

http://en.wikipedia.org/wiki/Kruskal's_algorithm

用于不相交集合的并集/查找数据结构。 。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏别ゝ 2024-10-12 02:10:16

它在 Kruskal 算法的条目中有所说明,但您可以使用 union/find 结构来测试(通过 FIND)边是否连接两个不同的树,或者添加时是否会形成循环。

如果边不形成循环并添加到生成树,则可以更新相同的结构(通过 UNION)。

It is stated in the entry for Kruskal's algorithm, but you can use the union/find structure to test (via FIND) if the edge connects two different trees or whether it will form a cycle when added.

The same structure can be updated (via UNION) if the edge does not form a cycle and is added to the spanning tree.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文