5.22. You are given a graph G = (V, E) with positive edge weights, and a minimum spanning tree T = (V, E') with respect to these weights; you may assume G and T are given as adjacency lists. Now suppose the weight of a particular edge e € E is modified from w(e) to a new value w(e). You wish to quickly update the minimum spanning tree T to reflect this change, without recomputing the entire tree from scratch. There are four cases. In each case give a linear-time algorithm for updating the tree. (a) e E' and wŵ(e) > w(e). (b) e E' and w(e) < w(e). (c) e E E' and w(e) < w(e). (d) e E' and wŵ(e) > w(e).
Note, you are given the tree T and the edge e = (y, z) whose weight is changed; you are told its old weight w(e) and its new weight w~(e) (which you type in latex by widetilde{w}(e) surrounded by double dollar signs).
In each case specify if the tree might change. And if it might change then give an
Part (a): e ∉ T and w~(e) > w(e):
[Blank space for the answer]
Part (b): e ∉ T and w~(e) < w(e):
[Blank space for the answer]
Part (c): e ∈ T and w~(e) < w(e):
[Blank space for the answer]
Part (d): e ∈ T and w~(e) > w(e):
[Blank space for the answer]
Trending now
This is a popular solution!
Step by step
Solved in 3 steps