How many edges would I need to add to $K_{n,m}$ to make it complete?

729 Views Asked by At

How many edges would I need to add to $K_{n,m}$ to make it complete (instead of bipartite)? $(n,m \to n+m)$

I know that $K_n$ has $\frac{n(n-1)}{2}$ edges and $K_{n,m}$ has $nm$ edges, but I can't figure out the general equation with this information

2

There are 2 best solutions below

2
On

It's useful to use examples for the problem in several cases and then work out the problem. For this type of problem, you need $\dbinom{n}{2} + \dbinom{m}{2}$ more edges to make $K_{m,n}$ complete.

Remember that $K_{m,n}$ is a complete bipartite graph, which has each of $m$ vertices connected with each of $n$ vertices. To get $\dbinom{n}{2}$, we need to pair $n$ nonadjacent vertices with edges in the first vertex set. Then, to get $\dbinom{m}{2}$, we also need to pair up each nonadjacent vertex with another in the second vertex set. This gives us the complete graph $K_{m + n}$. For both of those situations, order don't matter in the way we pair up the vertices in the same vertex set.

Note: You can do this as long as $m$ and $n$ are not both $1$. If either $m = 1$ or $n = 1$, but not both, then pair up the vertices in one of the vertex sets to get some number of edges. Then, either we get $\dbinom{m}{2}$ (if $n = 1$, but $m \neq 1$) or $\dbinom{n}{2}$ (if $m = 1$, but $n \neq 1$) or $0$ (if both $m = n = 1$).

0
On

@NasuSama's answer is a good approach (by counting how many edges we need to add in each partite set).

An alternative way: you have already noted that the number of edges in $K_n$ is $\frac{n(n-1)}{2}$. So the number of edges in $K_{m+n}$ is $\frac{(m+n)(m+n-1)}{2}$. Since we only have $mn$ edges in $K_{m,n}$, the number of edges we need to add is the difference: $$ \frac{(m+n)(m+n-1)}{2} - mn$$ With some algebraic manipulation we can show that this is the same as $\binom{n}{2} + \binom{m}{2}$.