A spanning tree of a graph is a tree that includes all vertices of the graph and is a subgraph of the original graph. A spanning tree contains the minimum number of edges needed to connect all vertices without creating any cycles.
Properties
A spanning tree of a graph with vertices has exactly edges.
Key Characteristics:
- Contains all vertices - Every vertex from the original graph appears in the spanning tree
- No cycles - The spanning tree is acyclic, making it a tree
- Connected - There exists a path between any two vertices
- Minimal connectivity - Removing any edge disconnects the spanning tree
- Maximal acyclicity - Adding any edge creates a cycle
Existence
A graph has a spanning tree if and only if the graph is connected.
For a connected graph with vertices:
- If the graph has exactly edges, it is itself a tree and its own spanning tree
- If the graph has more than edges, multiple spanning trees may exist
Construction
A spanning tree can be constructed from a connected graph using several methods:
Breadth-First Search (BFS)
- Start at any vertex
- Visit all adjacent vertices level by level
- Include edges that lead to unvisited vertices
- Continue until all vertices are visited
Depth-First Search (DFS)
- Start at any vertex
- Explore as far as possible along each branch
- Include edges that lead to unvisited vertices
- Backtrack when no unvisited adjacent vertices remain
Edge Removal
- Start with the original connected graph
- Identify any cycle
- Remove one edge from the cycle
- Repeat until no cycles remain