A spanning tree is a tree that connects every vertex in a graph. Because a tree has exactly one path between any two vertices, it contains no cycles; pruning suitable edges can turn a graph into one. section 4.3
In a weighted graph, the related minimum-spanning-tree problem asks for:
- A set of edges touching every vertex. section 4.3
- The smallest possible combined edge weight among spanning trees. section 4.3
- A practical minimum-cost connection for transportation or computer networks. section 4.3
Connecting cities
A weighted graph of 15 United States metropolitan areas uses distances as edge weights. Prim’s algorithm selects connecting edges to produce a spanning tree with total weight 5,372.

