Skip to main content
Logo image

Section 16.5 Spanning trees

spanning subgraph
a subgraph that contains all the vertices of the parent graph
spanning tree
a spanning subgraph that is a tree

Example 16.5.1. Spanning trees for the complete graph \(K_4\).

Here is the complete graph with four vertices.
The complete graph with four vertices.
And here are ten different spanning trees for \(K_4\text{.}\)
Ten spanning trees for the complete graph with four vertices.
If we carry out either of the depth-first or breadth-first search algorithms, but aren’t looking for a path between specific vertices, the end result will be a spanning tree for the original graph.
depth-first spanning tree
the result of performing the depth-first search algorithm on a graph, continuing until all vertices in the original graph appear in the search tree
breadth-first spanning tree
the result of performing the breadth-first search algorithm on a graph, continuing until all vertices in the original graph appear in the search tree

Example 16.5.2. Depth-first and breadth-first spanning trees.

Figure 16.5.3 contains depth-first and breadth-first spanning trees for the graph in Figure 16.4.4, our source of examples for depth-first search (Example 16.4.3) and breadth-first search (Example 16.4.7).
A depth-first spanning tree.
(a) Depth-first spanning tree for the graph in Figure 16.4.4.
A breadth-first spanning tree.
(b) Breadth-first spanning tree for the graph in Figure 16.4.4.
Figure 16.5.3. Examples of depth- and breadth-first spanning trees.