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.
Recommended Problems
- Would Kruskal or Prim’s algorithm work on a directed graph?
- True or false: Adding a constant to every edge weight does not change the solution to the MST problem (assume unique edge weights).
- True or false: Multiplying all edges weights with a constant does not change the solution to the MST problem (assume unique edge weights).
- True or false: It is possible that the only Shortest Path Tree is the only Minimum Spanning Tree.
- True or false: Prim’s Algorithm and Kruskal’s algorithm will always return the same result.
- [Adapted from Textbook 4.3.8] Prove the following, known as the cycle property: Given any cycle in an edge weighted graph (all edge weights distinct), the edge of maximum weight in the cycle does not belong to the MST of the graph.
- [Adapted from Textbook 4.3.12] Suppose that a graph has distinct edge weights. Does its shortest edge have to belong to the MST? Can its longest edge belong to the MST? Does a min-weight edge on every cycle have to belong to the MST? Prove your answer to each question or give a counterexample.
- [Adapted from Textbook 4.3.20] True or false: At any point during the execution of Kruskal’s algorithm, each vertex is closer to some vertex in its subtree than to any vertex not in its subtree. Prove your answer.
- True or False: Given any two components that are generated as Kruskal’s algorithm is running (but before it has completed), the smallest edge connecting those two components is part of the MST.
- How would you find the Minimum Spanning Tree if we consider total weight as the product of the edge weights rather than the sum of the edge weights. Assume that all edge weights are > 1.
- Q1a, Q1b from CS 61B 15sp Final
- Q1c, Q1e from CS 61BL 16su Final
- Q2 from CS 61BL 16su Final
- Q1 from CS 61B 17sp Final
- Q2b, Q2c from CS 61BL 17su Final
- Q7c from CS 61BL 17su Final
- Q1d, Q1e from CS 61B 18sp Final
- Q4c, Q4d, Q4f from CS 61BL 18su Final