東京大学 情報理工学系研究科 コンピュータ科学専攻 2019年8月実施 専門科目II 問題4
Author
Description
Consider a connected undirected graph
Answer the following questions.
(1) Let
(2) Consider an arbitrary vertex subset
(3) Describe an
(4) Assume that we are given a graph
(5) Prove the correctness of the algorithm described in question (4).
考虑一个具有正边权的连通无向图
回答以下问题。
(1) 设
(2) 对于
(3) 描述一个
(4) 假设我们给定一个图
(5) 证明问题 (4) 中描述的算法的正确性。
Kai
(1)
Let
Proof
- Step 1: Assume
is an MST that contains . - Step 2: Consider the cycle
in that includes . Since is a tree and contains all vertices of , adding to will create a cycle. - Step 3: In the cycle
, remove the edge (which has the maximum weight in ) to break the cycle, forming a new tree . Since we removed the edge with the maximum weight, has a smaller or equal total weight compared to . - Step 4: Conclude that
is also an MST, but it does not contain .
Therefore, there exists a minimum spanning tree that does not contain the edge
(2)
Consider an arbitrary vertex subset
Proof
- Step 1: Apply the Cut Property.** According to the Cut Property, for any cut in the graph, the minimum weight edge crossing the cut must be in the MST.
- Step 2: Define the cut associated with
as the set of edges where and . - Step 3: Since
is the minimum weight edge across this cut, by the Cut Property, must be included in every MST of .
Thus, there is a minimum spanning tree that contains the edge
(3)
Describe an
Algorithm
- Initialization: Initialize a stack (or queue) and mark all vertices as unvisited.
- Depth-First Search (DFS):
- Push the starting vertex
onto the stack and mark it as visited. - While the stack is not empty:
- Pop a vertex
from the stack. - If
, return the path from to . - For each adjacent vertex
of that is not visited, push onto the stack and mark it as visited.
- Pop a vertex
- Push the starting vertex
- Termination: If the search ends without finding
, return "No Path".
This algorithm runs in
(4)
Assume that we are given a graph
Algorithm
- Step 1: Add the new edge
to the MST . This will create a cycle in the tree. - Step 2: Find the maximum weight edge
in this cycle. - Step 3: If
, then the original MST is still valid. - Step 4: If
, remove from the cycle. The resulting graph is a tree and is the new MST.
The time complexity is
(5)
Prove the correctness of the algorithm described in question (4).
Proof
- Step 1: Adding edge
to the MST creates exactly one cycle, as was a tree. - Step 2: In the cycle, removing the maximum weight edge ensures that the resulting graph is still a tree with a total weight less than or equal to the original MST.
- Step 3: If
, then must be removed to maintain the minimality of the spanning tree, as introduces a smaller weight. - Step 4: This process guarantees that the resulting tree is the MST of
, thus proving the algorithm's correctness.
Knowledge
最小生成树 图论 DFS BFS 贪心算法
解题技巧和信息
- 最小生成树的关键性质可以通过切割定理和环路定理进行理解。
- 对于图中的路径查找问题,DFS 和 BFS 都是常用的线性时间算法。
- 解决最小生成树更新问题时,可以通过引入新边后检查形成的环并删除最大边的方式实现最小生成树的维护。
重点词汇
- Minimum Spanning Tree (MST) 最小生成树
- Cycle 环
- Cut Property 切割定理
- Depth-First Search (DFS) 深度优先搜索
- Breadth-First Search (BFS) 广度优先搜索
参考资料
- Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to Algorithms (3rd ed.). MIT Press. Chap. 23: Minimum Spanning Trees.
- Sedgewick, R., & Wayne, K. (2011). Algorithms (4th ed.). Addison-Wesley. Sections on Graph Algorithms.