0

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

0

2 Answers 2

1

Prim's algorithm doesn't mind negative weights.

Simply flip the sign of every edge's weight, and use the minimum spanning tree algorithm.

Sign up to request clarification or add additional context in comments.

1 Comment

are you sure that it does not assume that you cannot decrease the "weight" of the tree by adding new branches?
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.