Consider the following graph.

(a) What is the cost of its minimum spanning tree?

(b) How many minimum spanning trees does it have?

(c) Suppose Kruskal’s algorithm is run on this graph. In what order are the edges added to the MST? For each edge in this sequence, give a cut that justifies its addition.

Short Answer

Expert verified

a).The cost of its minimum spanning treeby usingKruskal’s algorithm is 19.

b).Theminimum number of spanning trees does is 2.

c). Theorder of the edges added to the MST or each edge in the sequence isAE,EF,BE,FG,GH,CG,andGD.

Step by step solution

01

A minimal spanning tree:

A minimal spanning tree is indeed an edge-weighted graph with a weight that is equal to which is less than the value about any other spanning tree.

02

The least cost of spanning tree.  

a)

Minimum spanning tree cost:

The number of edges for a minimal spanning tree may be calculated using the formula below.:

Numberofedges=Numberofvertices1

In Equation, replace"numberofvertices=8"with the value.

Numberofedges=81=7

The following are the steps to determining the least spanning tree:

Begin with the graph's vertices " A ."

• Each vertices "A " has two angles with such a load of 6 vertices point A to point B and 1 vertices from to .

• From A through E vertices, the minimum weight is 1 as indicated below:

Next, starts with vertex “B ”.

• The vertex "B " has four edges with weights of 6 vertices from B to A ,5 vertices from B to C ,2 vertices from B to E , and 2 vertices from B to F . From B to E vertices, the minimum weights are 2; from B to F vertices, the minimum weights are 2. Take a look at the initial minimal weight value. As a result, the minimal weight 2 from B to E vertices are as follows:

Then comes the vertex " C ."

• Each vertices " C " has four edges having weights of 5 vertices through C to B ,6 vertices as C to D,5 vertices from C to F, and 4 vertices from C to G.

• From C through G vertices, the lower limit is 4 as indicated below:

Then comes the vertex "D ."

• Each vertices "D" has four edges having weights of 5 vertices through D to B,6 vertices as D to D ,5 vertices from D to F, and 4 vertices from D to G.

• From D through G vertices, the lower limit is 4.

Then comes the vertex " E ."

• The vertex "E " has three edges with weights of one from E to A , two from E to B, and one from E to F vertices.

• The first and second weights have already been drawn.

From E through F vertices, the minimum weight is 1 as indicated below:

Next, begin with vertex "F ."

• The vertex "F " has four edges, each with a weight of one from F to E , two from F to B , five between F and C , and three from F to G .

• The first and second weights have already been drawn.

From F through G vertices, the minimum weight is 3 as indicated below:

The following vertex is "G."

• The vertex "G" has four edges with weights of 3 between G and F vertices,4 between G and C vertices,5 between G and D vertices, and 3 between G and H vertices.

• The third and fourth weights have already been drawn.

o From G through H vertices, the minimum weight is 3 as illustrated below:

Finally, the minimum spanning tree is shown below:

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

Therefore, the cost of the minimum spanning tree: 19

03

The number of minimum spanning tree in this graph.

b)

In the given graph, there are two possibilities of the minimum spanning tree. That is, we can take the weight 2 from B to E or weight 2 fromEtoF .

One possible minimum spanning tree with weight2fromBtoEand is given below:

Another possible minimum spanning tree with weight2fromEtoFand is given below:

Therefore, the number of minimum spanning tree in this graph is 2.

04

Run the MST using Kruskal’s algorithm:

c)

The minimum spanning tree using the Kruskal’s algorithm is given below:

In this MST,

• There are 7 edges are included into the minimum spanning tree such as,

AE,EF,BE,FG,GH,CG,andGD.

ForAEedge,thecutsareA,B,C,DandE,F,G,H.ForEFedge,thecutsareA,B,C,D,EandF,G,H.ForBEedge,thecutsareA,E,F,G,HandB,C,D.ForFGedge,thecutsareA,B,EandC,D,F,G,H.ForGHedge,thecutsareA,B,E,F,GandC,D,H.ForCGedge,thecutsareA,B,E,F,G,HandC,D.ForGDedge,thecutsareA,B,C,E,F,G,HandD.

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

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) .

In this problem, we will develop a new algorithm for finding minimum spanning trees. It is based upon the following property:

Pick any cycle in the graph, and let e be the heaviest edge in that cycle. Then there is a minimum spanning tree that does not contain e.

(a) Prove this property carefully.

(b) Here is the new MST algorithm. The input is some undirected graph G=(V,E) (in adjacency list format) with edge weights {we}.sort the edges according to their weights for each edge eE, in decreasing order of we:

if e is part of a cycle of G:

G = G - e (that is, remove e from G )

return G , Prove that this algorithm is correct.

(c) On each iteration, the algorithm must check whether there is a cycle containing a specific edge . Give a linear-time algorithm for this task, and justify its correctness.

(d) What is the overall time taken by this algorithm, in terms of |E|? Explain your answer.

Question: Suppose the symbols a,b,c,d,e occur with frequencies 12,14,18,116,116,respectively.

(a) What is the Huffman encoding of the alphabet?

(b) If this encoding is applied to a file consisting of1,000,1000 characters with the given frequencies, what is the length of the encoded file in bits?

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’s 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" fi·ci·li.

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

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