The maximum possible number of edges of a graph with n vertices and k components

graph theory

Following is my attempt:

For maximum possible edges $->$ all k components must be connected sub-graphs

Maximum possible edges in a graph with n vertices = ${n \choose 2}$, I thought of removing k-1 edges, but only to realise that doing so doesn't divide the graph into k components.

How should I proceed now?

Best Answer

Consider this problem combinatorially.

You have $n$ vertices partitioned into $k$ components. Assume $n \geq k$.

Consider the equation $n_1+n_2+\cdots+n_k=n$.

For each component with $n_i$ vertices, the maximum number of edges you can generate is $\displaystyle \binom{n_i}{2}$.

So, you want to maximize $\displaystyle \binom{n_1}{2}+\binom{n_2}{2}+\cdots \binom{n_k}{2}$.

Play with it for a while. The maximum result is obtained when $n_1=n-k+1$, and $n_2=n_3...=n_k=1$, and the maximum number of edges is $\displaystyle \binom{n-k+1}{2}$.