Tree or Connected acyclic graph

Trees are graphs that do not contain even a single cycle. They represent hierarchical structure in a graphical form. Trees belong to the simplest class of graphs. Despite their simplicity, they have a rich structure.

Trees provide a range of useful applications as simple as a family tree to as complex as trees in data structures of computer science.

Tree

A connected acyclic graph is called a tree. In other words, a connected graph with no cycles is called a tree.

The edges of a tree are known as branches. Elements of trees are called their nodes. The nodes without child nodes are called leaf nodes.

A tree with 'n' vertices has 'n−1' edges. If it has one more edge extra than 'n−1', then the extra edge should obviously have to pair up with two vertices which leads to forming a cycle. Then, it becomes a cyclic graph which is a violation for the tree graph.

Example 1

The graph shown here is a tree because it has no cycles and it is connected. It has four vertices and three edges, i.e., for 'n' vertices 'n−1' edges as mentioned in the definition ?

a b c d

Note − Every tree has at least two vertices of degree one.

Example 2

a b c d deg=1 deg=2 deg=2 deg=1

In the above example, vertices 'a' and 'd' have degree one. The other two vertices 'b' and 'c' have degree two. For not forming a cycle, there should be at least two vertices with degree one (leaf nodes).

Forest

A disconnected acyclic graph is called a forest. In other words, a disjoint collection of trees is called a forest.

Example

The following graph is a single disconnected graph with no cycles, hence it is a forest ?

a b c d e f g Tree 1 Tree 2

Spanning Trees

Let G be a connected graph, then a sub-graph H of G is called a spanning tree of G if −

  • H is a tree (connected and acyclic)
  • H contains all vertices of G

A spanning tree T of an undirected graph G is a subgraph that includes all vertices of G with the minimum number of edges (n−1) needed to keep the graph connected.

Example

Graph G a b c d 5 edges, has cycles Spanning Tree H a b c d 3 edges (n−1), no cycles

In the above example, G is a connected graph with 5 edges. H is a sub-graph of G that contains all four vertices but only 3 edges (n−1), has no cycles, and is connected. Hence H is a spanning tree of G.

Conclusion

A tree is a connected acyclic graph with n−1 edges for n vertices. A disconnected collection of trees is called a forest. A spanning tree of a connected graph includes all vertices with the minimum edges needed to maintain connectivity without any cycles.

Updated on: 2026-03-14T17:08:06+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements