跳到主要内容

Data Structure

Definition

G=(V,E)G=(V, E)中,找尋一組EE的subset TT使 w(T)=(u,v)Tw(u,v)w(T) = \sum_{(u,v) \in T} w(u, v),且TTacyclic,所以TT必定是一顆tree。

Growing a MST

找尋MST的做法,可以用greedy的方式,演算法如下:

GENERIC-MST(G, w)
A = ∅
while A does not form a spanning tree
find an edge (u, v) that is safe for A
A = A ∪ {(u, v)}
return A

我們要證明的就是在這個步驟做完,形成的spanning tree就是一顆MST。

Proofs

在證明GENERIC-MST之前,我們先定義幾個term:cut & light edge

Cut

一個undirected grpah G=(V,E) G = (V, E) 的一個Cut (S,VS)(S, V - S),代表VV的一個partition,也就是說 vV\forall v \in VvSv \in S or vVSv \in V-S

另外對於一個edge set AA,如果AA裡面的edge不cross (有一個edge (u,v)(u, v) ,其中 uS u \in S and vVSv \in V - S) 一個cut CC ,則我們稱 CC respects AA

Light edge

如果一個edge (u,v)(u, v)cross 一個 cut CC的edge裡面,weight 最低的edge,則被稱為light edge

Theorem 1

Statement: Let G=(V,E)G = (V,E) be a connected, unidrected graph with a real-valued weight function ww defined on EE. Let A be a subset of EE that is included in some minimum spanning tree for GG, let (S,VS)(S, V - S) be any cut of GG that respects AA, and let (u,v)(u, v) be a light edge crossing (S,VS)(S, V - S). Then, edge (u,v)(u, v) is safe for AA.

Proof:

我們可以利用反證法(proof by contradiction)來證明。我們定義light edge (u,v)(u, v)加入AA形成的tree為AA',如果edge (u,v)(u, v)不safe,則存在一個crossing edge (u,v)(u', v')(u,v)(u', v')加入AA形成AA'',使得w(A)<w(A)w(A'') < w(A')

w(A)=w(A)+w((u,v))w(A'') = w(A) + w((u', v')),而w(A)=w(A)+w((u,v))w(A') = w(A) + w((u, v)),因為w(A)<w(A)w(A'') < w(A'),可得到w((u,v))<w((u,v))w((u', v')) < w((u, v)),而已知(u,v)(u, v)是light edge,故任一crossing edge (u,v)(u', v')w((u,v))w((u,v)) w((u', v')) \geq w((u, v)),因此w(A)<w(A)w(A'') < w(A')與已知矛盾,故假設錯誤,因此light edge (u,v)(u, v)對A safe。

Corollary 1

Statement: Let G=(V,E) G = (V, E)be a connected, undirected graph with a real-valued weight function ww defined on EE. Let A be a subset of EE that is included in some minimum spanning tree for GG, and let C=(Vc,Ec)C = (V_c, E_c) be a connected component (tree) in the forest GA=(V,A)G_A = (V, A). If (u,v)(u, v) is a light edge connecting CC to some other component in GAG_A, then (u,v)(u, v) is safe for AA.

Proof:

The cut (VC,VVC)(V_C, V - V_C) respect AA,所以根據theorem 1,light edge (u,v)(u, v) is safe for AA