A forest is a graph with no cycles; a tree is a connected graph with no nontrivial closed trails.

Thus, a forest is a disjoint union of trees.


The following graph is a forest consisting of three trees:

A small forest

The following graph is a not a tree:

Not a graph

Consider the two conditions of being tree: being connected, and not having any cycles.

The first condition is somehow saying that has enough edges: to be connected, we need a path between any two vertices, and the more edges we have, the more likely this is to happen.

The second condition is somehow saying that doesn’t have too many edges: we don’t want cycles, and having more edges makes that more likely.

Thus, being a tree a bit of a goldilocks condition – it has just the right amount of edges. It’s not just how many edges the graph has, though – the path graph has 4 vertices and 3 edges, and is a tree, but the disjoint union of a triangle and a single vertex also has 4 vertices and 3 edges but is not a tree.

The following proposition summarises this discussion and makes it more precise:


Let be a graph with vertices. The following are equivalent:

  1. is a tree.
  2. Between any two vertices , there is a unique path.
  3. is connected, but removing any edge makes disconnected.
  4. has no cycles, but adding any edges to creates a cycle.
  5. is connected and has edges
  6. has no cycles and has edges


We will not show all of the equivalences. Some are tricky to do directly; a few we will put on the practice sheet.

1 implies 3

Trees are by definition connected, so we must show that removing any edge of disconnects . Let and be two adjacent vertices, and suppose removing the edge between them did not disconnect . Then there is a path from to in not using the edge connecting them; adding the last edge back in makes a cycle, a condtradiction.

3 implies 2

Since is connected, there is at least one path between two vertices. If there were two paths between and , then deleting any edge that was only in one of the paths wouldn’t disconnected .

2 implies 1

Suppose that is a graph with a unique path between any two vertices. Then, in particular is connected, and so to show is a tree we must show it has no cycles.

Suppose was a cycle in . Then there are two paths between and – the edge , or the path . This is a contradiction, and hence has no cycles.

We will also show that if is a tree with vertices, then has edges. Since we know trees are connected and have no cycles, this means any of 1-3 imply 5 and 6.

We proceed by induction: the proof is obvious when is one or two – a tree on one vertex has no edges, and a tree on two vertices has a single edge. Thus, we have a base case.

We now assume that all trees with at most vertices have edges for all and we must show that a tree with vertices has edges. Pick any edge of are remove it. By 3, the result is disconnected.

We claim that consists of exactly two connected components. Pick any two vertices . By 2, there is a unique path between them; if that path contains , there will be no path between in , and hence they must lie in different components of . If the path between and does not contain , then they will lie in the same component. Hence, if are the two ends of the edge , then every vertex of has a path to either or , but not both.

Thus, we see has two components and , each of which are trees: they are connected, and have no cycles. Suppose contain vertices; then must have vertices. By the inductive hypothesis, we know they must contain edges and edges respectively.

The edges in are and the edges of and , hence we see that has edges, as desired.