Consider a minimum spanning tree for a weighted graph G= (V, E)and a new edge e, connecting two existing nodes in V. Explain how to find a minimum spanning tree of the new graph in O(n)time, where n is the number of nodes in the graph. Prove correctness of the algorithm and justify the running time
After adding the new edge, we need to remove one edge from the new formed cycle in order to regain our minimum spanning tree. For this operation we will iterate over the new formed cycle and find the minimum weighted edge present in the cycle and delete the found edge.
This is correct because after deleteing the minimum weighted edge of the cycle, the cycle will break and also the egde deletion will lead to minimum weight beacause the edge chosen is the maximum weighted among all the edges present in the cycle.
The running time complexity of the algorithm is O(n) as we need to iterate once through the graph.
Get Answers For Free
Most questions answered within 1 hours.