/*! 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} Q5E Consider an undirected graph G=(... [FREE SOLUTION] | 91影视

91影视

Consider an undirected graph G=(V,E)with nonnegative edge weights role="math" localid="1658915178951" we0. Suppose that you have computed a minimum spanning tree of G, and that you have also computed shortest paths to all nodes from a particular node role="math" localid="1658915296891" sV. Now suppose each edge weight is increased by 1: the new weights are w0e=we+1.

(a) Does the minimum spanning tree change? Give an example where it changes or prove it cannot change.

(b) Do the shortest paths change? Give an example where they change or prove they cannot change.

Short Answer

Expert verified

a). No, the minimum spanning tree does not change.

b). YES, Whenever the border weight is raised by one, the shortest pathways may vary.

Step by step solution

01

 Minimum spanning tree.

The minimum spanning tree is evaluated by using algorithm that are Kruskal鈥檚 algorithm or prim鈥檚 algorithm where the shortest distance from the source and the destination is evaluated and check from which path it is minimum and called the minimum cost spanning tree.

02

 Check whether the minimum spanning tree change or not.

a).

Whenever the border weight is increased by one, the minimal spanning tree does not change. The smallest spanning tree is determined using Kruskal's technique (for finding Minimum Spanning Tree). Let's get started with the Kruskal method for graph.If a minimum spanning tree of G, and that have also computed shortest path for any kind of nodes it accepts particular node s 系 V

The simplest demonstration is that each spanning tree has " n-1 " edges since the graph " G " has " n " vertices. The following are the steps to determining the least spanning tree:

Let's start with vertex " A " on the graph.

The vertex " A " has two edges with weights of 1 between A and B vertices and 5 between A and D vertices. From A to B vertices, whose weight limit is 1 as indicated below, and after that, start with vertex " B ."

The vertex " B " has two edges, another B from to Something like A vertices and the other from B to C vertices, both having a weight of one.

The weight 1 vertices from B to A are already drawn. Then, from B through C vertices, the minimal weight 1 is assessed, as indicated below:

Then comes the vertex " C." The vertex "C " has two edges, one from C to B vertices and the other from C to D vertices, both having a weight of one.

Weight 1 has already been drawn from C to B vertices. Then, from C through D vertices, the minimal weight 1 is assessed, as indicated below:

The following vertex is " D ." The vertex " D" has two edges, one from D to C vertices and the other from D to A vertices, both having a weight of one.

Weight 1 has already been pulled from D to C . As a result, in vertex " D," there is no minimum weight.

Finally, theminimum spanning tree is shown below:

The cost of the minimum spanning tree is the sum of all the weighted edges. That is,

Cost=Sumofallweightededgesinminimumspanningtree=1+1+1,=3

Therefore, to use the Kruskal's method, the cost of path A to B is "1" then expense of path B to C is " 1 ," and the cost of path C to D is "1" in the graph "G ."

This revised graph "G " is comparable with above - the graph structure "G " except that each edge weight is increased by one. As a result, the cost of path D to A is "6" the cost of path A to B is "2" the cost of path B to C is "2" and the cost of path C to D is "2."

Steps to determine the minimum spanning tree using the Kruskal鈥檚 algorithm, From the graph,

Let鈥檚 start with the vertex 鈥 A 鈥. The vertex 鈥 A鈥 contains two edges with weight of 2 from A to B vertices and 6 from A to D vertices. Here, the minimum weight is 2 from A to B vertices and is shown below:

Next, starts with vertex 鈥 C 鈥.

鈥 The vertex 鈥 C 鈥 contains two edges with weight of 2 from C to B vertices and 2 from C to D vertices.

鈥 The weight 2 from B to A vertices are already drawn. Then, the minimum weight 2 from B to C vertices is considered.

Next, starts with vertex 鈥 C 鈥.

鈥 The vertex 鈥淐 鈥 contains two edges with weight of 2 from C to B vertices and 2 from C to D vertices.

鈥 The weight 2 from C to B vertices are already drawn. Then, the minimum weight 2 from C to D vertices is considered and is shown below:

Next, starts with vertex 鈥 D 鈥.

鈥 The vertex 鈥 D鈥 contains two edges with weight of 2 vertices and 6 from D to A vertices.

鈥 The weight 2 from D to C vertices is already drawn. So, there is no minimum weight in vertex 鈥 D 鈥. Then , the minimum spanning tree is shown below:

Finally, the minimum spanning tree is shown below:

The cost of the minimum spanning tree AD is the sum of all the weighted edges. That is,

Cost=Sumofallweightededgesinminimumspanningtree=2+2+2=6

Thus, the cost of path A to B is "2" cost of path B to C is "2" and cost of path C to D is "2" in graph 鈥 G 鈥 gives the minimum spanning tree using the Kruskal鈥檚 algorithm. Therefore, by incrementing each edge weight by same amount, the minimum spanning tree does not change. Here, proof of Kruskal鈥檚 algorithm is correct. So, it does not change.

03

Check whether the shortest paths change or not.

YES, Whenever the border weight is raised by one, the shortest pathways may vary.

鈥 Since the size of the path rises as the number of edges on the path increases, the shortest path may vary. In the updated graph, pathways with a small number of edges may be the shortest, but they are unaffected by the original graph.

The cost of path A to B is "1," cost of path B to C is "1," cost of path C to D is 1" and cost of road D to A is "5" as illustrated in the graph " G " below:

Apply Dijkstra's method to the following graph:

1: Begin the initialization process with node " A " and locate the nodes that are next to it. Set the value of the node " A " to " 0," and the rest of the nodes to "infinity." The nodes are next to the " A," node. Then, for each and every neighbour node of node "A" add the cost of "A" node. The node "B = 1" represents the lowest cost value. The following is a depiction of the shortest path tree when node "B = 1".

2. Select the nodes that are next to the minimal node " B." The nodes "C " and "A" are next to the "B" node. Then, for each and every neighbour node of node " B ," add the cost of " " node.

"1+1=2"forthe"A"node."1+1=2"forthe"C"node..

Node " A " is already drawn here. As an example, consider node "C = 2" as a minimum cost value.

Below is a depiction of the shortest path tree for node "C = 2"


3:Find the nodes that are next to the minimal node "C." The nodes "D" and "B" are next to the "C" node. Then, for each and every neighbour node of node "C," add the cost of "C" node.

"2+1=3"forthe"D"node.

"2+1=3"forthe"B"node.

The lowest cost from the nodes:

Node " B " is already drawn here. Assume that node " D=3 " has the lowest cost value.

The following is a depiction of the shortest path tree when node " D=3 ":

3: Identify the adjacent nodes for minimum node 鈥 鈥.

The adjacent nodes of 鈥淒鈥 node are 鈥 C 鈥 and 鈥 A 鈥. Then, add the cost of 鈥 D 鈥 node to each and every neighbour node of node 鈥 D 鈥.

鈥 For 鈥 C 鈥 node, 鈥 3+1=4鈥.

鈥 For 鈥 A 鈥 node, 鈥 3+5=8鈥.

Identify the minimum cost from the nodes:

鈥 Here, node 鈥 C 鈥 and node 鈥 A 鈥 are already drawn. So, there is no minimum value in the tree.

The representation of the shortest path tree is shown below:

Therefore, the final shortest-path tree for the given graph is as follows:

As a result, route is the shortest path from point A to point D, with a cost of "6 ". And when the edge weight is raised by the same amount, the shortest pathways may vary.

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

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.

The basic intuition behind Huffman鈥檚 algorithm, that frequent blocks should have short encodings and infrequent blocks should have long encodings, is also at work in English, where typical words like I, you, is, and, to, from, and so on are short, and rarely used words like velociraptor are longer.

However, words like fire!, help!, and run! are short not because they are frequent, but perhaps because time is precious in situations where they are used.

To make things theoretical, suppose we have a file composed of m different words, with frequencies f1,...,fm. Suppose also that for the ithword, the cost per bit of encoding is ci. Thus, if we find a prefix-free code where the ithword has a codeword of length Ii, then the total cost of the encoding will be localid="1659078764835" ficili.

Show how to modify Huffman鈥檚 algorithm to find the prefix-free encoding of minimum total cost.

Question:Show how to implement the stingy algorithm for Horn formula satisfiability (Section 5.3) in time that is linear in the length of the formula (the number of occurrences of literals in it). (Hint: Use a directed graph, with one node per variable, to represent the implications.)

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

(a) Run Prim鈥檚 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鈥檚 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.

Ternary Huffman. Trimedia Disks Inc. has developed 鈥渢ernary鈥 hard disks. Each cell on a disk can now store values 0,1, or 2(instead of just 0 or 1). To take advantage of this new technology, provide a modified Huffman algorithm for compressing sequences of characters from an alphabet of size n, where the characters occur with known frequencies f1, f2,...., fn. Your algorithm should encode each character with a variable-length codeword over the values 0,1,2, such that no codeword is a prefix of another codeword and so as to obtain the maximum possible compression. Prove that your algorithm is correct

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.