Practice Discrete Math

Algorithms / Mst Greedy

Least You Need to Know: Minimum Spanning Trees, Safe Edges, and Greedy Structure

Minimum spanning tree problems are a flagship example of provably correct greedy reasoning. The key concepts are cut-safe edges, the difference between tree weight and shortest-path objectives, and the way Kruskal and Prim each exploit a local choice rule that is globally safe.

The least you need to know

Key notation

MST minimum spanning tree
safe edge an edge that can be added while preserving the possibility of optimality
cut property the lightest edge crossing a cut is safe for some MST

Tiny worked example

  • In Kruskal's algorithm, sort edges by weight.
  • Add the next lightest edge that connects two different components.
  • The cut property justifies each safe choice.
  • Stop once the graph has `n-1` chosen edges and is connected.

Common mistakes

How to recognize this kind of problem

Start practice