1. Init the graph, each node is a seprate tree.
2. Arrage edges in ascending order.
1.( N1,N2) (N7,N8)
2. (N2,N3)
3. (N1,N6)
4. (N2,N6) (N3,N4)
5. (N2,N7)
6. (N3,N7) (N4,N8)
7. (N4,N7) (N4,N5)
8. (N6,N7) (N5,N8)
Add these edges in forest until all tree become a single tree & there is no loop in tree.
Adding edges of weight 1.
Adding edges of weight 2,3
Adding (N2,N6) will make loop so not adding it, adding (N3,N4) (N2,N7)
Adding of (N3,N7) (N4,N8) (N4,N7) will make loop so not adding these nodes.
Now adding (N4,N5)
Now adding of (N6,N7) & (N5,N8) will make loop so i will ignore these edges.
Hence no edges are left, the above tree is minimum spanning tree.