Prim’s Minimum Spanning Tree

Prim’s Minimum Spanning Tree

Source Code:
Github: PrimMinimumSpanningTree.java


Output:

************************ Graph ************************
       V(1)   V(2)   V(3)   V(4)   V(5)   
******************************************************
V(1)   -      4.0    1.0    -      -      
V(2)   4.0    -      2.0    1.0    2.0    
V(3)   1.0    2.0    -      5.0    -      
V(4)   -      1.0    5.0    -      3.0    
V(5)   -      2.0    -      3.0    -      
******************************************************



Minimum Spanning Tree 

************************ Graph ************************
       V(1)   V(2)   V(3)   V(4)   V(5)   
******************************************************
V(1)   -      -      1.0    -      -      
V(2)   -      -      2.0    1.0    2.0    
V(3)   1.0    2.0    -      -      -      
V(4)   -      1.0    -      -      -      
V(5)   -      2.0    -      -      -      
******************************************************    

Author: Hrishikesh Mishra