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

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?

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.

Show that if an undirected graph with n vertices has k connected components, then it has at least n - k edges.

Design a linear-time algorithm for the following task.

Input: A connected, undirected graphG.

Question:Is there an edge you can remove fromGwhile still leavingGconnected?

Can you reduce the running time of your algorithm toO(V)?

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