Link

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. Would Kruskal or Prim’s algorithm work on a directed graph?
  2. True or false: Adding a constant to every edge weight does not change the solution to the MST problem (assume unique edge weights).
  3. True or false: Multiplying all edges weights with a constant does not change the solution to the MST problem (assume unique edge weights).
  4. True or false: It is possible that the only Shortest Path Tree is the only Minimum Spanning Tree.
  5. True or false: Prim’s Algorithm and Kruskal’s algorithm will always return the same result.
  6. [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.
  7. [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.
  8. [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.
  9. 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.
  10. 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.
  11. Q1a, Q1b from CS 61B 15sp Final
  12. Q1c, Q1e from CS 61BL 16su Final
  13. Q2 from CS 61BL 16su Final
  14. Q1 from CS 61B 17sp Final
  15. Q2b, Q2c from CS 61BL 17su Final
  16. Q7c from CS 61BL 17su Final
  17. Q1d, Q1e from CS 61B 18sp Final
  18. Q4c, Q4d, Q4f from CS 61BL 18su Final