/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q22E Give You are given a graph  G=... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

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 e∉E'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) e∉E'and w'(e)>w(e) .

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

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

(d) role="math" localid="1658907887400" e∉E'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 e∉E'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 e∉E'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.e∉E. 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. e∉E 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 e∉E'. 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. e∉Eand 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. e∈E' 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 e∉E'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 91Ó°ÊÓ!

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

Suppose we want to find the minimum spanning tree of the following graph.

(a) Run Prim’s algorithm; whenever there is a choice of nodes, always use alphabetic ordering (e.g., start from node A). Draw a table showing the intermediate values of the cost array.

(b) Run Kruskal’s algorithm on the same graph. Show how the disjoint-sets data structure looks at every intermediate stage (including the structure of the directed trees), assuming path compression is used.

Give a linear-time algorithm that takes as input a tree and determines whether it has a perfect matching: a set of edges that touches each node exactly once.

A feedback edge set of an undirected graph G(V,E) is a subset of edgesE'⊂Ethat intersects every cycle of the graph. Thus, removing the edges will render the graph acyclic.

Give an efficient algorithm for the following problem:

Input: Undirected graph G(V,E) with positive edge weights we.

Output: A feedback edge set E'⊂Eminimum total weight ∑e∈E'we.

A binary counter of unspecified length supports two operations: increment (which increases its value by one) and reset (which sets its value back to zero). Show that, starting from an initially zero counter, any sequence of n increment and reset operations takes time O(n); that is, the amortized time per operation is O(1) .

The following statements may or may not be correct, In each case, either prove it (if it is correct) or give a counter-example (if it isn’t correct). Always assume that the graph G=(V,E)is undirected. Do not assume that edge weights are distinct unless this is specifically stated.

  1. If a graph G has more than |V|-1edges, and there is a unique heaviest edge, then this edge cannot be part of a minimum spanning tree.
  2. If G has a cycle with a unique heaviest edge e, then e cannot be part of any MST.
  3. Let e be any edge of minimum weight in G. Then e must be part of some MST.
  4. If the lightest edge in a graph is unique, then it must be part of every MST.
  5. If e is part of some MST of G, then it must be a lightest edge across some cut of .
  6. If G has a cycle with a unique lightest edge e must be part of every MST.
  7. The shortest-path tree computed by Dijkstra’s algorithm is necessarily an MST.
  8. The shortest path between two nodes is necessarily part of some MST.
  9. Prim’s algorithm works correctly when there are negative edges.
  10. (For any r>0, define an r-path to be a path whose edges all have weight <r). If G contains an r-path from node s to t , then every MST of G must also contain an r-path from node s to node t.

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

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.