Professional Documents
Culture Documents
3 Kruskals Algorithm
Kruskals Algorithm
Pick the cheapest link (edge) available and mark it Pick the next cheapest link available and mark it again Continue picking and marking link that does not create the circuit ***Kruskals algorithm is efficient and optimal
7 5 4 10 3 8 2
7 5 10 10 3 8 4 2
6 MST: 2+3+4+5+10=24
H W P
Find the length of the shortest network connecting the three cities A, B, C shown in each figure.
C A 25 37 A B C Apply Kruskals Algorithm: Since we know that length AB is always longer than the other two edges, so we pick: 250 mi and 300 mi. MST = 550 mi This is an isosceles triangle so there must be two equal edges Apply Kruskals Algorithm: Since we know that length AB is always longer than the other two edges, so we pick: 212 mi and 212 mi. MST = 424 mi 25 B