Minimum Spanning Tree: Difference between revisions
No edit summary |
|||
Line 18: | Line 18: | ||
</math> | </math> | ||
= Suboptimality = | |||
The MST problem exhibits the optimal substructure property. | |||
Given MST tree for the graph G | |||
<math> | |||
OPT = \text{set of edges} | |||
</math> | |||
where the number of edges is <math>n - 1</math>, the weight of edges is | |||
minimum, and the tree is spanning. | |||
Consider <math>(x,y)</math>, where X is a leaf node. | |||
Prove that <math>A = OPT - (x, y)</math> is a MST for the subproblem | |||
<math>G - X</math> | |||
By contradiction, assume that <math>A</math> is not optimal. There must | |||
be <math>B</math> such that | |||
<math> | |||
w(B) < w(A) | |||
</math> | |||
Adding the edge (x, y) back to both graphs | |||
<math>B + (x, y)</math> is a viable tree. | |||
<math> | |||
w(B + w(x,y)) < w(A + w(x,y)) = w(OPT) | |||
</math> | |||
Therefore, OPT is not the optimal solution. | |||
By contradiction, <math>A</math> must be optimal. | |||
[[Category:Algorithms]] | [[Category:Algorithms]] |
Revision as of 01:27, 8 March 2024
A minimum spanning tree is
- a tree, meaning it has no cycle
- minimum, meaning it has minimum weight
- spanning, meaning it connects all nodes
MST Problem
The MST problem takes a connected graph and outputs an MST for that graph.
Approach: Greedy
The approach is to try to add the smallest edges as long as they do not create a cycle; add an edge to the tree that is minimum across the cut of vs.
Given the MST of , the MST of should be that of plus the edge that connects to that is the shortest.
Suboptimality
The MST problem exhibits the optimal substructure property.
Given MST tree for the graph G
where the number of edges is , the weight of edges is minimum, and the tree is spanning.
Consider , where X is a leaf node.
Prove that is a MST for the subproblem
By contradiction, assume that is not optimal. There must be such that
Adding the edge (x, y) back to both graphs
is a viable tree.
Therefore, OPT is not the optimal solution.
By contradiction, must be optimal.