logo
  • 教程列表
  • SO官方文档
  • Kruskal 的算法
    • 基于最佳脱节集的实现
    • 简单更详细的实现
    • 简单的基于不相交集的实现
    • 简单的高级实现
  1. StackOverflow 文档
  2. algorithm 教程
  3. Kruskal 的算法
  4. 简单的高级实现

简单的高级实现

Created: November-22, 2018

按值排序边缘,如果不创建循环,则按排序顺序将每个边缘添加到 MST。

algorithm kruskalMST(G: a graph)
    sort G's edges by their value
    MST = an empty graph
    for each edge e in G:
        if adding e to MST does not create a cycle:
            add e to MST

    return MST
  • 简单的基于不相交集的实现

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明