Minimum Spanning Tree

From Rice Wiki
Revision as of 17:40, 20 March 2024 by Rice (talk | contribs) (→‎Approach: Greedy)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A minimum spanning tree is

  • a tree, meaning it has no cycle
  • minimum, meaning it has minimum weight
  • spanning, meaning it connects all nodes

The MST problem takes a connected graph and outputs an MST for that graph.

Algorithm that solves this problem includes Kruskal's Algorithm and Prims Algorithm.

Suboptimality

The MST problem exhibits the optimal substructure property.

Given MST tree for the graph G

Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle OPT = \text{set of edges} }

where the number of edges is Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n - 1} , the weight of edges is minimum, and the tree is spanning.

Consider Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (x,y)} , where X is a leaf node.

Prove that Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle A = OPT - (x, y)} is a MST for the subproblem Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle G - X}

By contradiction, assume that Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle A} is not optimal. There must be Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle B} such that

Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w(B) < w(A) }

Adding the edge (x, y) back to both graphs

Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle B + (x, y)} is a viable tree.

Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w(B + w(x,y)) < w(A + w(x,y)) = w(OPT) }

Therefore, OPT is not the optimal solution.

By contradiction, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle A} must be optimal.