Algorithms for computing MST [00OH]
Here are three algorithms to compute a minimum spanning tree:
- Kruskal's Algorithm: repeatedly pick the shortest edge that doesn't complete a cycle with other already-picked edges.
- Prim's Algorithm: repeatedly pick the shortest edge that connects a visited vertex to an unvisited vertex and doesn't complete a cycle.
- Reverse-delete: repeatedly delete the longest edge that doesn't disconnect the graph.
It's kind of amazing that all these greedy approaches work. It's almost like we can't mess it up no matter what we try. But how do we know that they work?