Minimum Spanning Trees Study Guide

Minimum Spanning Trees. Given an undirected graph, a spanning tree T is a subgraph of G, where T is connected, acyclic, and includes all vertices. The minimum spanning tree is the spanning tree whose edge weights have the smallest sum. In many graphs, the minimum spanning tree is not the same as the shortest paths tree for any particular vertex.

Cut Property. If you divide the vertices up into two sets S and T (arbitrarily), then a crossing edge is any edge which has one vertex in S and one in T. The cut property states that a minimum crossing edge for any cut is part of the minimum spanning tree.

Prim’s Algorithm. One approach for finding the MST is as follows: Starting from any arbitrary source, repeatedly add the shortest edge that connects some vertex in the tree to some vertex outside the tree. If the MST is unique, then the result is independent of the source (doesn’t matter where we start). Prim’s algorithm can be seen as Dijkstra’s algorithm with modifications to how edges are considered in order of distance to the MST-under-construction, rather than distance to the source. This definition of distance to the tree also has an important implication: when relaxing the neighbors of a vertex, we need to make sure that we don’t modify the MST-under-construction.

Kruskal’s Algorithm. As an alternate algorithm, we also considered Kruskal’s algorithm for finding an MST as an alternative view of iterative application of the cut property. Kruskal’s algorithm considers each edge in order of increasing edge weight. For each edge, add it to the MST if it does not introduce a cycle. We can rephrase this problem as determining the connected components in a graph. The runtime for Kruskal’s therefore depends on the implementation for determining connected components.

  1. Will Prim’s algorithm (from any start vertex) and Kruskal’s algorithm always return the same MST?
  2. [Adapted from Textbook 4.3.8] Suppose that a graph has distinct edge weights. Prove the cycle property: Given any cycle, the edge of maximum weight in the cycle does not belong to the MST of the graph.
  3. [Adapted from Textbook 4.3.12] Suppose that a graph has distinct edge weights. Does the lightest edge need to belong to the MST? Can the heaviest edge belong to the MST? Does a minimum-weight edge on every cycle need to belong to the MST?
  4. Given any two components that are generated as Kruskal’s algorithm is running (but before it has completed), is the smallest edge connecting those two components guaranteed to be a part of the final MST?
  5. Suppose we have a connected graph with 3 edges of weight exactly 0 but all other edges have distinct, positive weights. How many MSTs are in the graph?
  6. Q1a, Q1b from CS 61B 15sp Final (Solution)
  7. Q1 from CS 61B 17sp Final (Solution)
  8. Q2b, Q2c from CS 61BL 17su Final (Solution)