i2tutorials

DAA- Spanning Trees

Spanning Trees

 

In this article, we will be learning about the Spanning tree with an example, its properties, and applications.

 

What is a Spanning tree?

Suppose that we have a graph G that contains vertices V and edges E, then the graph can be represented as follows:

G(V, E)

While creating a spanning tree from the above graph we see that it will contain the same number of vertices as the graph, but the vertices are not equal. The edges in the spanning tree would be one less than the number of edges in the graph.

 

Suppose the spanning tree is represented as:

G`(V`, E`)
where,
V=V`
E`ϵ E -1
E`=|V| - 1

 

Example:

Suppose that we want to create a spanning tree from the graph below:

Spanning Trees

 

As we know, the spanning tree would contain the same number of vertices as the graph. Here, the total number of vertices in the graph is 5; therefore, the spanning tree will also contain 5 vertices. Also, the number of edges in the spanning tree must be equal to the number of vertices in the graph minus 1; therefore, the number of edges is 4. From the above graph, three spanning trees can be created, these are shown below:

 

Properties of Spanning tree

 

For example, if we take 5 as the value of n then the number of spanning trees would be equal to 125.

A where each pair of vertices are connected is called a complete graph. Consider the following complete graph which has 3 vertices:

Here, e is the number of edges, and n is the number of vertices. When we substitute the value of e and n in the formula, then we get the value 1. This means that a maximum of 1 edge can be removed from the graph to make a spanning tree. In all the above spanning trees, one edge has been removed.

 

Applications of Spanning trees

 

Exit mobile version