Question

You are given an undirected graph G with weighted edges and a minimum spanning tree T of G.


You are given an undirected graph G with weighted edges and a minimum spanning tree T of G. Design an algorithm to update the minimum spanning tree when the weight of a single edge is decreased. 

The input to your algorithm should be the edge e and its new weight; your algorithm should modify T so that it is still a MST. Analyze the running time of your algorithm and prove its correctness.

3 0
Add a comment Improve this question Transcribed image text
Answer #1

Algorithm:

1. Check whether edge whose weight is decreased exists in T

2. If it exists then MST will not change but weight of MST will be decreased

3. If edge is not present in MST then add that edge to MST

4. A cycle is formed in MST. Delete the heaviest edge from cycle to get new MST.

Complexity: O(V) as a cycle of maximum V vertices need to be traversed.

Precondition: MST given

Postcondition: MST from algorithm

The algorithm will always return a MST if T is MST.

Add a comment
Know the answer?
Add Answer to:
You are given an undirected graph G with weighted edges and a minimum spanning tree T of G.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT