0

a. Four vertices are labeled $1,2,3,4$. In how many ways can edges be drawn between some pairs of these vertices so that the result is a connected graph?

b. Five vertices are labeled $1,2,3,4,5$. In how many ways can edges be drawn between some pairs of these vertices so that the result is a connected graph?

I know this question has been asked before but I didn't understand the answer. I don't know how to solve this problem so I would be grateful for help.

Math_Guy
  • 166

2 Answers2

0

I'd just approach the problem by induction. There are $2^{n \choose 2}$ possible graphs with $n$ vertices. (Each possible edge either exists or it does not.) How many of them are disconnected?

If there are two vertices, there are $2$ graphs, $1$ disconnected and $1$ connected.

If there are three vertices and the graph isn't connected, there are $4$ distinct possible disconnected components, each of which can exist in only one way. For example, $1-2$ may be one connected component, leaving $3$ to be the other. There are $8$ possible graphs, so $4$ of them are connected.

If there are $4$ vertices, the possible partitions into connected components of disconnected graphs are $\{1, 1, 1, 1\}, \{2, 1, 1 \}, \{2, 2 \}, \text{ and } \{3, 1 \}$. There is $1$ set of $4$ isolated points, there are ${4 \choose 2} = 6$ sets of $2$ isolated points, there are $3$ more sets of $2$ connected components of $2$ points each. Each of those sets of connected components results in exactly $1$ graph each. There also are $4$ sets of $1$ isolated point, each of which (by the previous paragraph) results in $4$ more graphs, for an additional $16$. Therefore, there are $26$ graphs that are not connected. There are $2^{4 \choose 2} = 64$ possible graphs on $4$ vertices, so $38$ of them are connected.

The calculation for $5$ vertices is similar, but a bit more tedious.

Robert Shore
  • 26,056
  • 3
  • 21
  • 49
0

The number of connected graphs on $n$ labeled vertices, call it $a_n$, satisfies the recurrence $a_n=2^{\binom n2}-\sum_{k=1}^{n-1}\binom{n-1}k2^{\binom k2}a_{n-k}$. Here $2^{\binom n2}$ is the total number of graphs on $n$ labeled vertices, from which we have to subtract the number of disconnected graphs; $\binom{n-1}k2^{\binom k2}a_{n-k}$ is the number of graphs in which exactly $k$ vertices are not in the connected component containing vertex $1$.

For example, $a_1=a_2=1$, $a_3=4$, $a_4=38$, and $$a_5=2^{\binom52}-\binom412^{\binom12}a_4-\binom422^{\binom22}a_3-\binom432^{\binom32}a_2-\binom442^{\binom42}a_1$$ $$=1024-4\cdot1\cdot38-6\cdot2\cdot4-4\cdot3\cdot1-1\cdot64\cdot1=1024-296=728.$$

Or you could just look it up; this is sequence A001187 in the On-Line Encyclopedia of Integer Sequences.

bof
  • 82,298