Give You are given a graphG=(V,E)with positive edge weights, and a minimum spanning tree T=(V,E)with respect to these weights; you may assume GandTare given as adjacency lists. Now suppose the weight of a particular edge eE'is modified fromw(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) eE'and w'(e)>w(e) .

(b) role="math" localid="1658907878059" eE'and w'(e)>w(e) .

(c) role="math" localid="1658907882667" eE'and w'(e)>w(e) .

(d) role="math" localid="1658907887400" eE'and w'(e)>w(e) .

Short Answer

Expert verified

Use G and T as adjacency lists and if weight of special edge is change from old value w(e) to new value w'(e) faster update minimum spanning tree to reflect change.

Step by step solution

01

Minimum Spanning Tree:

A minimal spanning tree (MST as a minimum spanning tree) is a subgroup of something like a tree that has the shortest packets from the source to all of its vertex points. A graph G = (V,E) Some minimum spanning tree is shown, along with edge weights that are positive. T=(V,E) such as relation to all of these weights. Take a look at the clustering lists. Graph G and T are supplied. After this step suppose that a particular edge’s weight is altered from w(e) to w'(e) .

02

Update w(e) > w'(e) is answer for (a).

a).

Algorithm:

Input:

Graph: G = (V,E)

minimum spanning tree: T = (V,E)

Procedure is given as

Declare T and G as adjacency list

Declare e ,

if (e is in e )

Modify w(e)to w'=e.

Else If (e is not in [E])

Update w (e) > w'(e)

Explanation of the given equation is as follows:

Consider the minimum spanning tree when the weight of one edge eE'is decreased. Assume that e=(u,v) .Add edge e to T tree that will create a distinct cycle, that can be found applying breadth first search and not considering weights. And this will take OT=OV time. And remove the cycle's maximum weight edge OV.

In this way linear time algorithm for updating a tree when eE'and w(e) > w'(e) is given.

03

Update T with e∉E'and w'(e) < w (e) : 

(b).

Algorithm:

Input:

Graph: G = (V,E)

minimum spanning tree: T = (V,E)

Procedure is given as

Declare T and G as adjacency list

Declare e ,

if ( is in e )

Modify w(e) to w'(e) .

Else If (e is not in [E])

Making change w(e) to w'(e) .

Else If (e is not in [E])

Update w'(e)<w(e)<p=" ">

Update T with w'(e) .

End.

Explanation:

Take into account the MST while one of the edge's weights is increased, as well as the outcomes of a Kruskal method.eE. That outcome is just the same as when edge demand is higher and also the minimum value gets chosen by the algorithm. (This suggests that the edges' weights are distinct.) Whenever the tree is updated in this fashion, a linear time approach is used. eE and w(e) < w'(e) is given.

04

Prove e∉E and w'(e) < w(e) .

(c)

Algorithm:

Input:

Graph: G = (V,E)

minimum spanning tree: T = (V,E)

Procedure is given as

Declare T and G as adjacency list

Declare e ,

if ( is in e)

Update w'(e) <w (e) <p=" ">

Update Tu with w' = (e)

Update Tvwith w'(e)

end

Explanation:

Analyse how minimum spanning t until one of the edges is heavier than the other eE'. And it is increased Let e = (u,v) and just let the subtrees that were created by deleting them e be Tvand Tu. With BFS (breadth first search )(ignoring weights of edges) , It really is possible to detect whichever vertices are all in the localid="1658916013612" Tu and which are in Tv in time localid="1658917474694" OV+EAssume each node is marked with its membership.

Each edge is checked and edge e' with having one endpoint Tu and Tvhaving the other only are kept This is possible to be done in time OV . Then the complete runtime is OV+E. Whenever the tree is updated throughout this fashion, a linear time approach is used. eEand w(e) > w'(e) is given.

05

Step 5: Prove e∉E  and w'(e) >w (e)  .

(d).

Algorithm:

Input:

Graph: G = (V,E)

minimum spanning tree: T = (V,E)

Procedure is given as

Declare T and G as adjacency list

Declare e ,

wedge cost W ;

decrement

when (w - d ), new cost T'

If (e is in [E])

Update w'(e)<w(e)<p=" "style=" box-sizing-box;"></w(e)<>

Update Tu with w’(e) with T'

Update Tv with w’(e) with T'

End

Explanation:

Whenever one of the edge's weights changes, think about the MST. eE' is reduced. Assume that T is the tree, and W is the weight of the tree. Once the value of the edge gets reduced by d, their actual cost is ( W - d ). Describe the subtrees of T as Tu and Tv , when edge e is deleted. Assuming T somehow doesn't stay an MST, its edge e is required for any T' to continue an MST. But both Tu and Tv Otherwise, T may not even be basic to begin with if they weren't MSTs with each respective node sets. As a result, the weight Tv can’t be lesser ( W - d ). Whenever a tree is updated in this fashion, a linear time approach is used eE'and w(e) > w'(e) .

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Show how to find the maximum spanning tree of a graph, that is , the spanning tree of largest total weight.

Let T be an MST of graph G. Given a connected subgraph H of G, show that TH is contained in some MST of H

Let G=(V,E) be an undirected graph. Prove that if all its edge weights are distinct, then it has a unique minimum spanning tree

Ternary A server has customers waiting to be served. The service time required by eachcustomer is known in advance: it is ciminutes for customer i. So if, for example, the customers are served in order of increasing i , then the ithcustomer has to wait Pij=1tjminutes. We wish to minimize the total waiting time.

T=Xni=1(time spent waiting by customer ).

Give an efficient algorithm for computing the optimal order in which to process the customers.

A prefix-free encoding of a finite alphabet Γ assigns each symbol in Γ a binary codeword, such that no codeword is a prefix of another codeword. A prefix-free encoding is minimal if it is not possible to arrive at another prefix-free encoding (of the same symbols) by contracting some of the keywords. For instance, the encoding {0,101} is not minimal since the codeword 101 can be contracted to 1 while still maintaining the prefix-free property.

Show that a minimal prefix-free encoding can be represented by a full binary tree in which each leaf corresponds to a unique element of Γ, whose codeword is generated by the path from the root to that leaf (interpreting a left branch as 0 and a right branch as 1 ).

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free