联合查找最小边的排序列表
我有一个用于图中连接组件的联合查找数据结构,但需要能够快速找到组件中的最小边。现在,我正在为每个组件保留一个排序的边列表,但这会使两个组件的并集变慢。除了保留组件的排序列表之外,还有什么更好的方法建议吗?
I have a union find data structure for connected components in my graph, but need to be able to find a minimum edge in a component quickly. Right now I'm keeping a sorted list of edges for each component, but this makes the union of two components slow. Any suggestions for a better approach than keeping a sorted list for components?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许有比您在问题中注意到的更多的要求,但如果您只需要最小边缘,为什么不只跟踪每个组件的最小边缘而不是每个组件的完整排序边缘列表呢?
Maybe there are more requirements than you note in your question, but if you just need the minimum edge, why not just keep track of the minimum edge for each component rather than a complete sorted list of edges for each component?