Benjamin
Benjamin

Reputation: 85

how to find maximum spanning tree using prims algorithm?

I want to modify Prim's algorithm so that it find the maximum spanning tree how can this be done

Upvotes: 0

Views: 5225

Answers (2)

bashrc
bashrc

Reputation: 4835

Even going greedy for maximum edge instead of minimum edge will help.

Upvotes: 0

NPE
NPE

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

Related Questions