Graph problem about roads built between towns

759 Views Asked by At

There are 10 cities in a country. The Government starts to build direct roads between the cities, but with random access, it can build direct road between two cities even if there is already another road that connects them. Between every two of the cities only one road will be build. How many roads are needed to be build, so the Government can be sure that every two cities will be connected with this road.

The right number is 37, but I don't know the method how to get there.

1

There are 1 best solutions below

0
On BEST ANSWER

In a graph with $n$ vertices, we need $\binom{n-1}{2} + 1$ edges to ensure that is it connected.

In this case, the number of vertices is represented by the number of cities, $10$.

So,

$$\binom{n-1}{2} + 1=\binom{9}{2} + 1 = 37$$