A spanning tree connects every vertex in a graph without forming a cycle, so it always has one fewer edge than vertices. See why adding each new vertex requires just one connecting edge, and how this simple rule relates to connected graphs and their structure.

Multiple Choice

A spanning tree on a graph with V vertices contains how many edges?

A spanning tree is a connected acyclic subgraph that includes all the vertices of the graph. For such a tree with V vertices, the number of edges is exactly V minus 1. This can be seen by starting with one vertex and then adding each new vertex with a single connecting edge; after adding V−1 vertices, you’ve added V−1 edges. So the spanning tree uses V−1 edges no matter how many edges the original graph had, as long as the graph is connected. The other counts don’t generalize: V would imply a cycle for more than one vertex, E refers to the original graph’s edges, and E−1 isn’t guaranteed to form a spanning tree.

A connected graph can contain far more edges than it needs to keep every vertex reachable. A spanning tree shows just how much structure is enough: it includes every vertex, stays connected, and contains no cycles. If the graph has (V) vertices, any spanning tree has exactly (V-1) edges.

That count may seem surprising at first. Why not (V) edges, or a number tied to the original graph’s edge count? The key is that a tree grows by connecting new vertices one at a time. Each new vertex needs one edge to join the growing structure. Start with one vertex, then add the remaining (V-1) vertices. The result uses (V-1) edges.

A spanning tree keeps every vertex in the picture

In graph theory, a graph is made of vertices and edges. Vertices might represent cities, computers, or tasks; edges show the links between them. A spanning tree is a subgraph that includes all the original graph’s vertices while selecting only enough edges to connect them without forming a cycle.

“Spanning” means no vertex gets left out. “Tree” means the selected edges form a connected structure with no closed loop. These two conditions work together: the subgraph must reach everyone, but it can’t contain unnecessary routes that loop back to where they began.

Imagine a set of towns connected by roads. A spanning tree is a selection of roads that lets people travel between every pair of towns, while avoiding a loop of roads. The original road network may have many extra routes, but the tree keeps only the links needed for connectivity.

Why the count is (V-1)

The clearest way to see the edge count is to build the tree.

Begin with a single vertex. It is connected to itself in the sense that there’s only one point to consider, and it needs no edges. Now add a second vertex. To connect it to the existing structure, add one edge. Add a third vertex, and one more edge is enough. Continue until all (V) vertices are included.

The first vertex needs no connecting edge. Each of the other (V-1) vertices needs one edge to join the tree. So the total is:

[

1 + 1 + \cdots + 1 = V-1

]

This construction also explains why the number doesn’t depend on how many edges the original graph has. A dense graph may offer many possible routes, while a sparse graph may offer only a few. Any spanning tree still selects exactly (V-1) edges.

For example, suppose a connected graph has six vertices. A spanning tree contains five edges. It could take different forms: a straight chain, a star with one central vertex, or a branching shape. The arrangement changes, but the count doesn’t.

Connectivity and cycles: two sides of the same idea

The edge count is tied to a basic trade-off. If a graph has all (V) vertices and fewer than (V-1) edges, it can’t be connected. There simply aren’t enough links to join every vertex into one component.

On the other hand, a connected graph with more than (V-1) edges must contain at least one cycle. Once the vertices are connected with (V-1) edges, any extra edge creates another route between some vertices. That added route closes a loop.

This gives a useful way to recognize a tree: a graph with (V) vertices is a tree if it is connected and has (V-1) edges. There are other equivalent ways to describe trees, but this one makes the relationship between connectivity and edge count easy to remember.

A small detail matters here: the original graph must be connected for it to have a spanning tree. If it has separate components, no selection of its existing edges can connect vertices across those gaps. In that case, we can talk about a spanning forest—a collection of trees that includes all vertices, with one tree for each component.

The edge count doesn’t tell the whole story

Knowing that a spanning tree has (V-1) edges doesn’t tell us which edges it contains. A graph can have many different spanning trees, each with the same number of edges. In a network diagram, several selections might connect all devices without loops.

That’s where edge weights can matter. If each edge has a cost—perhaps the price of laying cable or the distance between two locations—then we may want a minimum spanning tree. It still contains (V-1) edges, but it aims to minimize their total weight.

Algorithms such as Kruskal’s and Prim’s find a minimum spanning tree in a connected, weighted, undirected graph. Kruskal’s method considers edges in order of weight and avoids adding one that would create a cycle. Prim’s method grows a tree outward, choosing a low-cost edge that connects the current tree to a new vertex. Different approaches, same structural limit: (V-1) edges.

This is a nice example of how a simple fact can support a larger idea. The edge count stays fixed, while the choice of edges changes according to the goal.

Why the other counts don’t fit

The original graph’s edge count, often written as (E), can vary widely. A spanning tree doesn’t use all those edges; it selects a subset. So (E) isn’t the general count for a spanning tree, and neither is (E-1).

Nor does the tree generally contain (V) edges. For a connected graph with (V) vertices, (V) edges would mean there is more than the minimum needed to stay connected. That extra edge creates a cycle. A tree has no cycles, so it stops at (V-1).

There’s one harmless edge case: a graph with a single vertex has (V=1), so its spanning tree has (1-1=0) edges. The rule still holds. It doesn’t need a special patch or exception.

A compact rule with wide reach

The formula (V-1) is more than a fact to memorize. It reflects the way a tree balances two demands: every vertex must be reachable, and no edge can be redundant without creating a cycle. Remove any edge from a tree, and it falls into two separate pieces. Add an extra edge between vertices already connected, and a cycle appears.

That balance is useful in computer networks, road planning, electrical layouts, and many other settings where connections matter. A spanning tree strips a graph down to its essential links. However crowded the original network may be, its tree form uses exactly one fewer edge than it has vertices.