Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 806 Bytes

File metadata and controls

13 lines (11 loc) · 806 Bytes

Prim-Algorithm

A function that receives a graph and a weight function (list of edge nodes and weights for each edge) and returns a minimum spanning tree of that graph by running the PRIM algorithm. In the second part of the project, I wrote a function that accepts a minimum spanning tree, a newly added edge and its weight. The function updates the spanning tree with the addition of the new edge.

I ran the program with a graph with 20 nodes and 50 edges and weights. The program will find a minimal spanning tree and print it. I created a new edge and printed it - an edge which does not change the spanning tree. I found the updated spanning tree and printed it to the screen. I created an edge that will indeed change the spanning tree and printed it. I screen printed the updated spanning tree.