利用线程实现克鲁斯卡尔算法
我正在实现克鲁斯卡尔算法,并且我想利用线程。然而我不确定我对算法是否足够了解来做到这一点。
我的想象是,图表的不同部分将得到解决并最终连接起来。有人能指出我正确的方向吗?谢谢。
I'm implementing Kruskal's algorithm and I'd like to utilize threads. However I am not sure I know enough about the algorithm to do this.
What I imagine is that I'd different parts of the graph would be solved for and connected at the end. Can anyone point me in the right direction? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自维基百科
因此,您可能会研究该论文中提到的算法,但 Kruskal 可能不会从多线程中受益。
From Wikipedia
So, you might look into the algorithm mentioned in that paper, but Kruskal probably won't benefit from multiple threads.
Kruskal 的 MST 算法很难并行化,因为它以严格指定的顺序考虑边。您应该看看 Boruvka 的 算法,该算法更容易并行化它可以独立地作用于部分MST的每个子树。
Kruskal's algorithm for MST is hard to parallelize because it considers edges in a strictly specified order. You should take a look at Boruvka's algorithm which is easier to parallelize as it can work on each subtree of a partial MST independently.