Show that graph with $n$ vertices is a tree if it has has no cycle and has $n-1$ edges

669 Views Asked by At

I have an assignment:

Show that an $n$-vertex graph $G$ is a tree if and only if $G$ has no cycle and has $n − 1$ edges.

And I am kind of stuck on it right now (I was never good at proofs in general).

My current idea is this:

Suppose that graph $G$ is a tree (connected, acyclic graph) with $n$ vertices and $n - 1$ edges.
Since $G$ is a tree, there exists a path between any pair of vertices.
Let $uv \in E(G)$ s.t. there is path between $u$ and $v$.
Now add an edge between $u$ and $v$. G now contains $n - 1 + 1 = n$ edges and there are now two paths between $u$ and $v$. Connecting these paths will create a cycle $\Rightarrow$ $G$ is no longer a tree.

But I don't know if that even makes any sense. And if it makes sense, is it enough?

I am also pretty sure that there is a better way of proving this, but I just can't think of anything.

1

There are 1 best solutions below

3
On

Your argument doesn't really make sense. You're starting off your proof by assuming that $G$ is a tree and that it has $n-1$ edges which are basically both the directions of the statement you want to prove. You should first start with the assumption that $G$ is a tree and prove that it has $n-1$ edges and then do the opposite by assuming that $G$ is acyclic and has $n-1$ edges and prove that it is a tree.

Here are some hints:

  • For the ($\implies$) direction: use induction on $n$. Remove a leaf from $G$ and use the inductive hypothesis.

  • For the ($\impliedby$) direction: assume that $G$ has $k$ connected components. Since it's acyclic, every connected component is a tree. How many edges does $G$ have? (use the forward implication)