MathematicsDiscrete MathematicsMedium

Tree (graph theory)

Also known as:Free TreeAcyclic Connected Graph

A tree in graph theory is a connected, undirected graph containing no cycles, which means any two vertices are joined by exactly one unique path. A tree with n vertices always has exactly n − 1 edges. Trees are foundational data structures in computer science (binary search trees, heaps, syntax trees) and appear in network design, organisational hierarchies, and phylogenetics.

Key Formula

Number of edges = Number of vertices − 1

LaTeX: |E| = |V| - 1

SymbolMeaningUnit
|E|Number of edges in the treenone
|V|Number of vertices in the treenone

Worked Example

Problem

A company has a hierarchical org chart with 1 CEO, 3 VPs each reporting to the CEO, and 4 employees each reporting to one VP. Model this as a tree and verify the edge count.

Solution

Step 1: Identify vertices: 1 CEO + 3 VPs + 12 employees = 16 vertices total. Step 2: Identify edges (reporting lines): CEO→VP1, CEO→VP2, CEO→VP3 = 3 edges. Each VP has 4 employees: 3 × 4 = 12 edges. Step 3: Total edges = 3 + 12 = 15. Step 4: Verify using tree formula: |E| = |V| − 1 = 16 − 1 = 15. ✓ Step 5: Confirm it is a tree: connected (everyone links to CEO), no cycles (each employee has exactly one manager).

Answer

16 vertices, 15 edges. Formula |E| = |V| − 1 verified. The org chart forms a valid tree.

Properties and Types of Trees in Graph Theory

TypeDescriptionKey PropertyApplication
Free TreeUnrooted connected acyclic graph|E| = |V| − 1Spanning trees, networks
Rooted TreeOne vertex designated as rootParent-child relationshipsOrg charts, DOM trees
Binary TreeEach node has at most 2 childrenMax 2 children per nodeBinary search, heaps
Spanning TreeTree connecting all vertices of a graphSubgraph of original graphMinimum spanning tree (Kruskal)
Balanced TreeAll leaves at same or adjacent levelsHeight ≈ log₂(n)AVL trees, efficient search

Interactive Tools

Brilliant — Trees in Graph Theory

Open Tool

GeoGebra — Tree Visualiser

Open Tool

Khan Academy — Trees and Graphs

Open Tool
A tree graph with 7 vertices and 6 edges demonstrating the acyclic connected structure

Wikimedia Commons, CC BY-SA

Related Terms

The use of "tree" as a mathematical term was introduced by Arthur Cayley in 1857 in his paper on the enumeration of chemical isomers (rooted trees representing molecular structures). The biological metaphor was apt: a tree grows without forming loops and has a natural branching hierarchy.

graph-theoryacyclicspanning-treedata-structuresdiscrete-math