0% found this document useful (0 votes)
32 views12 pages

Mathematical Programming-II: Prim's Algorithm

Uploaded by

syed hamza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views12 pages

Mathematical Programming-II: Prim's Algorithm

Uploaded by

syed hamza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Mathematical Programming-II

Lecture 7
Prim’s algorithm
Zulfiqar Ahmad
Lecturer
Department of Information Technology
Hazara University Mansehra
[email protected]

1
Prim’s algorithm

Prim’s algorithm is a greedy algorithm:


• Any connected sub-graph of k vertices and k – 1 edges is a partial
solution
• The value to any partial solution is the sum of the weights of the edges

Then given a partial solution, we


• Add that edge which does not create a cycle in the partial solution and
which minimizes the increase in the total weight
• We continue building the partial solution until the partial solution has n
vertices
• An optimal solution is found

You might also like