# Every simple undirected graph with more than $(n-1)(n-2)/2$ edges is connected

If a graph with $n$ vertices has more than $\frac{(n-1)(n-2)}{2}$ edges then it is connected.

I am a bit confused about this question, since I can always prove that for a graph to connected you need more than $|E|>n-1$ edges.

• hint: What if you have one isolated vertex (not connected to any other vertices) what is the maximum number of edges in the graph? – Joe Nov 22 '12 at 0:42

I am not sure what bothers you but as I see it you are confused about the following two facts

1. If a graph is connected then $e \geq n-1.$

2. If a graph has more than $e > \frac{(n-1)(n-2)}{2}$ then it is connected.

Notice that the implications in 1 and 2 are in opposite directions.

For a proof of 2. you can check out this link.

I think your problem might be to prove that you cannot construct an undirected graph with $\dfrac{(n-1)(n-2)}{2}$ edges that is not connected. You are thinking about it the wrong way. The $E = n - 1$ formula about how few edges can you use to connect all the vertices.

Imagine you are an adversary trying to design a horrible highway system so that one town is disconnected. No matter how inefficiently you spend your roads, you'll still have to connect all the towns if there are so many roads.

Consider what the worst possible design could be, eg, the one that uses as many roads as possible but still leaves one town disconnected. How many edges does that have? What happens when you add one more edge to that?

1.As you mentioned we have:

$G\text{ is connected} \Rightarrow |V|-1 \le |E|$

But the other direction is not true, i.e:

$G\text{ is connected} \Leftrightarrow |V|-1 \le |E|$

is wrong statement.

So you can not use it for further reasoning. Sample counter example is this graph ($K_t$ is a complete graph on $t$ vertices, and $\cup$ means disjoint union of graphs):

$G = K_{n-1} \cup K_1$

$G$ has $n-1\choose 2$ edges and $n$ nodes, and ${n-1\choose 2} > n-1$ for $n>4$.

2.On the other hand, to prove that :

${|V|-1 \choose 2} < |E| \Rightarrow G\text{ is connected}$

We can do it as follow:

Suppose not, then $G$ is disjoint union of two graphs $G=G_1\cup G_2$, with $|G_1| = k, |G_2| = n-k, 0<k<n$, if we connect all the vertices of $G_1,G_2$ together to make graph $G"$, then $|E_{G"}|\le {n \choose 2}$ (because $G"$ has at most as complete graph edges) but:

${n-1 \choose 2} + 1 + k\cdot (n-k) \le |E_{G"}| \le {n \choose 2} \Rightarrow$

$(k-1)(n-k-1) + 1 \le 0\Rightarrow$ Contradicts with $0<k<n$.

Graph G has n nodes n=(n-1)+1 A graph to be disconnected there should be at least one isolated vertex.A graph with one isolated vertex has maximum of C(n-1,2) edges.

so every connected graph should have more than C(n-1,2) edges.

• Trees are connected graphs with substantially fewer than $C(n-1,2)$ edges. I guess you meant that every graph with more than $C(n-1,2)$ edges must be connected. But even that doesn't quite work because all you've shown is that a graph with that many edges can't have an isolated vertex: it's possible to be disconnected but have no isolated vertices. In any case, the question isn't really asking for a proof that every graph with more than $C(n-1,2)$ edges is connected: it's asking why $n-1$ edges isn't enough. – David Richerby Dec 9 '15 at 7:42