next up previous
Next: Weighted Union Up: KRUSKAL'S ALGORITHM Previous: Kruskal's Algorithm (Refined)

Proof Of Correctness

Let T be the spanning tree for G generated by Kruskal's algorithm. Let tex2html_wrap_inline508 be a minimum cost spanning tree for G. Show that both T and tex2html_wrap_inline508 have the same cost.

Proof:If edges of T and tex2html_wrap_inline508 are the same, we are done.
Let tex2html_wrap_inline518 .
Let e be a minimum cost edge such that tex2html_wrap_inline522 and
tex2html_wrap_inline524
i.e e is minimum cost edge in tex2html_wrap_inline528

figure172

Inclusion of e in tex2html_wrap_inline508 creates a cycle. Let tex2html_wrap_inline534 be this cycle.

figure178

At least one of tex2html_wrap_inline536 through tex2html_wrap_inline538 is not in T else e will form cycle in T as well.

Let that edge be tex2html_wrap_inline546 .

If tex2html_wrap_inline548 then tex2html_wrap_inline550 would be selected by Kruskal's algorithm first and included into T. But tex2html_wrap_inline546 .
tex2html_wrap_inline556

(because of choice of e, tex2html_wrap_inline550 would have been considered for inclusion in a subset tex2html_wrap_inline562 of tex2html_wrap_inline564 . Hence, tex2html_wrap_inline550 would not form a cycle in tex2html_wrap_inline562 because tex2html_wrap_inline570 .)

Consider tex2html_wrap_inline572
Here the cycle created by tex2html_wrap_inline574 is broken by tex2html_wrap_inline550

Cost of tex2html_wrap_inline578 is no more than that of tex2html_wrap_inline508 which does not have e in it.
Repeat this process for all such edges in tex2html_wrap_inline585 to eventually convert tex2html_wrap_inline508 into T without increasing cost.

Hence, T is a minimum spanning tree.

(Thus, greedy strategy which is locally optimal decision leads to a global optimal solution for spanning tree problem.)



Sushil Prasad
Thu Nov 4 14:09:59 EST 1999