Implementation of Kruskal's algorithm
Enter the number of nodes9
Enter the adjacency matrix
Enter the input for 1 1
0
Enter the input for 1 2
4
Enter the input for 1 3
0
Enter the input for 1 4
0
Enter the input for 1 5
0
Enter the input for 1 6
0
Enter the input for 1 7
0
Enter the input for 1 8
5
Enter the input for 1 9
2
Enter the input for 2 1
4
Enter the input for 2 2
0
Enter the input for 2 3
4
Enter the input for 2 4
2
Enter the input for 2 5
0
Enter the input for 2 6
0
Enter the input for 2 7
0
Enter the input for 2 8
0
Enter the input for 2 9
1
Enter the input for 3 1
0
Enter the input for 3 2
4
Enter the input for 3 3
0
Enter the input for 3 4
4
Enter the input for 3 5
0
Enter the input for 3 6
0
Enter the input for 3 7
0
Enter the input for 3 8
0
Enter the input for 3 9
0
Enter the input for 4 1
0
Enter the input for 4 2
2
Enter the input for 4 3
4
Enter the input for 4 4
0
Enter the input for 4 5
9
Enter the input for 4 6
0
Enter the input for 4 7
0
Enter the input for 4 8
0
Enter the input for 4 9
3
Enter the input for 5 1
0
Enter the input for 5 2
0
Enter the input for 5 3
0
Enter the input for 5 4
9
Enter the input for 5 5
0
Enter the input for 5 6
6
Enter the input for 5 7
0
Enter the input for 5 8
0
Enter the input for 5 9
7
Enter the input for 6 1
0
Enter the input for 6 2
0
Enter the input for 6 3
0
Enter the input for 6 4
0
Enter the input for 6 5
6
Enter the input for 6 6
0
Enter the input for 6 7
5
Enter the input for 6 8
1
Enter the input for 6 9
4
Enter the input for 7 1
0
Enter the input for 7 2
0
Enter the input for 7 3
0
Enter the input for 7 4
0
Enter the input for 7 5
0
Enter the input for 7 6
5
Enter the input for 7 7
0
Enter the input for 7 8
5
Enter the input for 7 9
0
Enter the input for 8 1
5
Enter the input for 8 2
0
Enter the input for 8 3
0
Enter the input for 8 4
0
Enter the input for 8 5
0
Enter the input for 8 6
1
Enter the input for 8 7
5
Enter the input for 8 8
0
Enter the input for 8 9
8
Enter the input for 9 1
2
Enter the input for 9 2
1
Enter the input for 9 3
0
Enter the input for 9 4
3
Enter the input for 9 5
7
Enter the input for 9 6
4
Enter the input for 9 7
0
Enter the input for 9 8
8
Enter the input for 9 9
0
The edges of the minimum cost spanning tree is
Edge 1 ( 2 , 9 )= 1
Edge 2 ( 6 , 8 )= 1
Edge 3 ( 1 , 9 )= 2
Edge 4 ( 2 , 4 )= 2
Edge 5 ( 2 , 3 )= 4
Edge 6 ( 6 , 9 )= 4
Edge 7 ( 6 , 7 )= 5
Edge 8 ( 5 , 6 )= 6
Minimum cost= 25