15 November 2020 2 479 Report

Let G = (V, E) be a connected graph and c : E → R be a cost function on its edges such that different edges have different costs.

T ← (V, ∅);

while (T is unconnected) do

let T1, T2, . . . Tp be the connected components of T; // p > 2

for (i = 1, p) do

let ei ∈ E such that c(ei) = min {c(uv) : uv ∈ E, u ∈ V (Ti), v /∈ V (Ti)};

E(T) ← E(T) ∪ {e1, e2, . . . , ep};

return T;

Prove that

(a) after each while iteration the number of connected components of T is at least halved;

(d) the number of the while iterations is O(log n) and each while iteration takes O(m) time, hence the overall time complexity of the above algorithm is O(m log n). ( n = |V |, m = |E|)

Similar questions and discussions