Minimum Spanning Tree
Connect every node as cheaply as possible, with no wasted links: the cheapest way to wire a network.
After this lesson you will be able to
- Define a spanning tree and a minimum spanning tree (MST), and state how many edges a spanning tree has.
- Explain the cut property and why it makes greedy choices safe.
- Run Kruskal's algorithm (sort edges, skip those that close a cycle) with Union-Find.
- Run Prim's algorithm (grow one tree with a heap) and say when each is preferable.
- Handle disconnected graphs, ties, and “connect all points” problems on a plane.
Before you start. Union-Find is essential for Kruskal. Heap and Shortest Paths help with Prim, which looks very much like Dijkstra.