There are five cities in a network. The cost of building a road directly between i and j is the entry ai,j in the matrix below. An infinite entry indicates that there is a mountain in the way and the road cannot be built. Determine the least cost of making all the cities reachable from each other.

0 3 5 11 9
3 0 3 9 8
5 3 0 [infinity] 10
11 9 [infinity] 0 7
9 9 10 7 0

Respuesta :

Solution :

Given :

There are five cities in a network and the cost of [tex]\text{building}[/tex] a road directly between [tex]i[/tex] and [tex]j[/tex]  is the entry [tex]a_{i,j}[/tex]

[tex]a_{i,j}[/tex]  refers to the matrix.

Road cannot be built because there is a mountain.

The given matrix :

[tex]\begin{bmatrix}0 & 3 & 5 & 11 & 9\\ 3 & 0 & 3 & 9 & 8\\ 5 & 3 & 0 & \infty & 10\\ 11 & 9 & \infty & 0 & 7\\ 9 & 8 & 10 & 7 & 0\end{bmatrix}[/tex]

The matrix on the left above corresponds to the weighted graph on the right.

Using the [tex]\text{Kruskal's algorithm}[/tex] we can select the cheapest edge that is not creating a cycle.

Starting with 2 edges of weight 3 and the edge of weight 5 is forbidden but the edge is 7  is available.

The edge of the weight 8 completes a minimum spanning tree and total weight 21.

If the edge of weight 8 had weight 10 then either of the edges of weight 9 could be chosen the complete the tree and in this case there could be 2 spanning trees with minimum value.

ACCESS MORE
ACCESS MORE
ACCESS MORE
ACCESS MORE