200 likes | 384 Views
Kruskal’s Algorithm. An Example. Apply Kruskal’s Algorithm to the following weighted graph. Create a sorted list of edges. 1 DE 2 CD EF 3 AB BE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL. Connect the shortest edge. 1 DE 2 CD EF 3 AB BE GH IJ
E N D
Kruskal’s Algorithm An Example
Create a sorted list of edges 1 DE 2 CD EF 3 AB BE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the shortest edge 1 DE 2 CD EF 3 AB BE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CD EF 3 AB BE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 AB BE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 AB BE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Remove cycle forming edges 1 DE 2 CDEF 3 ABBE GH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBEGH IJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBEGHIJ 4 AD CG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCG EI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Remove cycle forming edges 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCG EI 5 ACDH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Remove cycle forming edges 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 ACDHFJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 AC DH FJ IL 6 BF GK HI 7 HK 8 KL 9 JL
Remove cycle forming edges 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 ACDH FJIL 6 BF GK HI 7 HK 8 KL 9 JL
Connect the next shortest edge that does not form a cycle 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 AC DH FJ IL 6 BFGKHI 7 HK 8 KL 9 JL
Remove cycle forming edges 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 AC DH FJIL 6 BFGKHI 7 HK 8 KL 9 JL
All edges have been accounted for 1 DE 2 CDEF 3 ABBEGHIJ 4 ADCGEI 5 AC DH FJ IL 6 BFGKHI 7 HK 8 KL 9 JL