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.

  • 5
    $\begingroup$ hint: What if you have one isolated vertex (not connected to any other vertices) what is the maximum number of edges in the graph? $\endgroup$
    – Joe
    Commented Nov 22, 2012 at 0:42

6 Answers 6


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$.


A simple graph with n vertices is connected if it has more than (n−1)(n−2)/2 edges.

The n vertex graph with the maximal number of edges that is still disconnected is a Kn−1

a complete graph Kn−1 with n−1 vertices has (n−1)/2edges, so (n−1)(n−2)/2 edges.

Adding any possible edge must connect the graph, so the minimum number of edges needed to guarantee connectivity for an n vertex graph is ((n−1)(n−2)/2) + 1

hence, a simple graph having 'n' number of vertices must be connected if it has more than (n−1)(n−2)/2 edges


Theorem: given a graph $G$ with $k$ components, the number of edges $m$ is inside the range $$ n - k \leq m \leq \frac{(n-k+1)(n-k)}{2} $$

You can find the proof of this theorem in Chapter 3 of "Graph Theory " by Robin J. Wilson. So I will skip the proof, if you need I will edit the answer.

If a graph has two components, it means that $k = 2$ and then it has a maximum of edges equal to $$ \frac{(n-1)(n-2)}{2} $$

If a graph has a higher number of edges, it means that $k=1$. Therefore the graph is connected.


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.

  • 1
    $\begingroup$ 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. $\endgroup$ Commented Dec 9, 2015 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.