**Spanning Tree**: In this tutorial, you will learn about **spanning trees** and **minimum spanning trees** with the assistance of examples and figures.

Before we learn about spanning trees, we need to understand two graphs: undirected graphs and directed graphs.

An **undirected graph** is a graph wherein the edges don’t point toward any path (ie. the edges are bidirectional).

A **connected graph** is a graph wherein there is consistently a way from a vertex to some other vertex.

In this article, you will learn-

## What is a spanning tree?

The **spanning trees** of a graph (G) is a subset of G that covers the entirety of its vertices using the minimum number of edges.

A few properties of a spanning trees can be concluded from this definition:

- Since “a spanning tree covers the entirety of the vertices”, it can’t be disconnected.
- Spanning trees can’t have any cycles and comprise (n-1) edges (where n is the number of vertices of the graph) since “it uses the minimum number of edges”.

A graph can have more than one spanning tree. Truth be told, a total graph can have a maximum of *n** ^{n}*−

^{2}spanning trees.

## Spanning trees

A ** spanning trees** is a sub-graph of an undirected associated graph, which incorporates all the vertices of the graph with a minimum conceivable number of edges. In the event that a vertex is missed, then it is not a spanning trees.

The edges could conceivably have weights assigned to them.

The total number of spanning trees with n vertices that can be created from a total graph is equivalent to n

^{(n-2)}

On the off chance that we have n = 4, the maximum number of conceivable spanning trees is equivalent to 4^{4-2} = 16. Along these lines, 16 spanning trees can be formed from a complete graph with 4 vertices.

## Illustration of a Spanning Trees

Let’s understand the spanning trees with models underneath:

Let the original graph be:

Normal graph

A portion of the conceivable spanning trees that can be created from the above graph is:

A spanning tree

A spanning tree

A spanning tree

A spanning tree

A spanning tree

A spanning tree

## Minimum Spanning Trees

A minimum spanning trees is a spanning trees in which the sum of the weight of the edges is as minimum as possible.

## Illustration of a Spanning Trees

Let’s understand the above definition with the assistance of the example underneath.

The underlying diagram is:

Weighted graph

The possible spanning trees from the above graph are:

Minimum spanning tree – 1

Minimum spanning tree – 2

Minimum spanning tree – 3

Minimum spanning tree – 4

The minimum spanning trees from the above spanning trees is:

Minimum spanning tree

The minimum spanning trees from a graph is found using the following algorithms:

## Spanning Trees Applications

- Computer Network Routing Protocol
- Cluster Analysis
- Civil Network Planning

## Minimum Spanning trees Applications

- To find paths in the map
- To design networks like telecommunication networks, water supply networks, and electrical grids.

Thanks for reading! We hope you found this tutorial helpful and we would love to hear your feedback in the Comments section below. And show us what you’ve learned by sharing your photos and creative projects with us.