Let G be a graph and T be its MST, suppose we increase the weight of an edge e € T by a positive quantity 8. Give an algorithm that gets G,T,e and 8 as input and returns a MST of the new graph. Prove the correctness of your algorithm and state the run-time
solution:
given data:
Algorithm
Steps
1. Remove the edge e =(u,v)
2, After removing we get two connected sub tree lets say T1 and T2
3. Now use BFS Traversal in both sub-trees starting from u and v respectively (ignore edge weights) to know which vertices are there in T1 and Which are there in T2
4. Now examine each Edge of Graph G and keep the minimum weight edge e' with one endpoint in T1 and the other in T2
5.Once we find the min edges connecting any vertex in T1 with any vertex in T2 Then out MST T is again completed
Proof
As we know that An edge e in MST in increased so to check that MST is still minimum or not
Proof
Assume that
MST is still Minimum only with same edge e connected
Proof
We remove the edge e =(u,v)
Now we get two different connected components and acc to MST we need one more edge to connect them
Let the graph be G
1 .Traverse each edge see if it connects the components of not
2 . If Yes then Mark it minimum
else
Check other edge
3. Repeat above steps until all edges have been visited and
If any other edge that connects the Components
So Compare Minimum with new edge weight
and updated minimum if new edge weight < minimum
Now we have edge connecting two connecting and weight is stored in Minimum
4. Check that removed edge e weight and minimum is same or not
If not then our assumption is wrong
And by contradiction we say Graph is not still a MST that means that edge e has to replaced .
So By using above algorithm we will get correct MST
Hence Proved
Time Complexity of algorithm
1 .We are applying BST to check the vertexes So it will take O(V+E)
2. IN step 4 we are traversing each edge in graph to get minimum edge weight connection between sub trees So O(E) time is needed
hence Total Time Complexity = O( V+ 2 E) = O(V+E)
where V is the number of Vertices and E is number of Edges in G
This is how using above we can get the New MST if any edge weight in MST is increased
please give e thumb up
Let G be a graph and T be its MST, suppose we increase the weight of...
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 increased. 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.
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.
MST For an undirected graph G = (V, E) with weights w(e) > 0 for each edge e ∈ E, you are given a MST T. Unfortunately one of the edges e* = (u, z) which is in the MST T is deleted from the graph G (no other edges change). Give an algorithm to build a MST for the new graph. Your algorithm should start from T. Note: G is connected, and G − e* is also connected. Explain...
Let G=(V, E) be a connected graph with a weight w(e) associated with each edge e. Suppose G has n vertices and m edges. Let E’ be a given subset of the edges of E such that the edges of E’ do not form a cycle. (E’ is given as part of input.) Design an O(mlogn) time algorithm for finding a minimum spanning tree of G induced by E’. Prove that your algorithm indeed runs in O(mlogn) time. A minimum...
Updating an MST when an edge weight changes. You have a graph G= (V, E) with edge weights given in the graph (whatever they are). In addition, a minimum spanning tree T= (V, E′) of this graph has also been given to you. Now, say we need to increase the weight of one particular edge e. Does the MST change? If so, show how to compute the new MST in linear time. You should consider two cases: 1). when e∈E′and...
Suppose we have a graph G = (V, E) with weights on the edges of E, and we are interested in computing a Minimum Spanning Tree (MST) of G. Suppose we modify the DFS algorithm so that when at a vertex v, we next visit the unvisited neighbor u such that the weight of (u, v) is minimized. Does this produce a MST of G? prove that it does or provide a counter example.
Problem 4 Let G = (V. E) be an undirected, connected graph with weight function w : E → R. Furthermore, suppose that E 2 |V and that all edge weights are distinct. Prove that the MST of G is unique (that is, that there is only one minimum spanning tree of G).
Let G be a weighted undirected graph with n vertices. Let G' be a graph that is identical to G except that every edge weight is increased by a constant value c. Prove or disprove the following statement. Every MST in G is also an MST in G'.
need help filling in the code
def prim(G): Use Prim's algorithm to find a MST for the graph G … # Initialize tree T with a single vertex and no edges v = next(iter( )) # while the vertex set of T is smaller than the v+tex set of G, # (i.e. while the vertex set of T is a proper subset of the vertex set of G), find the edge e with minimum weight so that # Tte is...
2. Let G = (V, E) be an undirected connected graph with n vertices and with an edge-weight function w : E → Z. An edge (u, v) ∈ E is sparkling if it is contained in some minimum spanning tree (MST) of G. The computational problem is to return the set of all sparkling edges in E. Describe an efficient algorithm for this computational problem. You do not need to use pseudocode. What is the asymptotic time complexity of...