Reputation: 85
I want to modify Prim's algorithm so that it find the maximum spanning tree how can this be done
Upvotes: 0
Views: 5225
Reputation: 4835
Even going greedy for maximum edge instead of minimum edge will help.
Upvotes: 0
Reputation: 500157
Prim's algorithm doesn't mind negative weights.
Simply flip the sign of every edge's weight, and use the minimum spanning tree algorithm.
Upvotes: 1