0% found this document useful (0 votes)
59 views5 pages

What Is Spanning Tree? What Are The Properties and Applications of Spanning Tree?

Spanning tree is a subset of edges in a graph that connects all vertices while avoiding cycles. A minimum spanning tree is a spanning tree with the minimum possible total edge weight. Two common algorithms for finding minimum spanning trees are Kruskal's algorithm and Prim's algorithm. Kruskal's algorithm sorts all edges by weight and builds the tree by adding edges in increasing weight order if they do not create cycles. Prim's algorithm grows a tree from an initial vertex by repeatedly adding the lowest-weight edge that connects the tree to another vertex. Both algorithms use a greedy approach to efficiently find optimal minimum spanning trees.

Uploaded by

akurathikotaiah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views5 pages

What Is Spanning Tree? What Are The Properties and Applications of Spanning Tree?

Spanning tree is a subset of edges in a graph that connects all vertices while avoiding cycles. A minimum spanning tree is a spanning tree with the minimum possible total edge weight. Two common algorithms for finding minimum spanning trees are Kruskal's algorithm and Prim's algorithm. Kruskal's algorithm sorts all edges by weight and builds the tree by adding edges in increasing weight order if they do not create cycles. Prim's algorithm grows a tree from an initial vertex by repeatedly adding the lowest-weight edge that connects the tree to another vertex. Both algorithms use a greedy approach to efficiently find optimal minimum spanning trees.

Uploaded by

akurathikotaiah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

What is Spanning Tree?

What are the properties and applications of Spanning


Tree?
A spanning tree is a subset of Graph G, which has all the vertices covered with minimum possible
number of edges. Hence, a spanning tree does not have cycles and it cannot be disconnected..
By this definition, we can draw a conclusion that every connected and undirected Graph G has at
least one spanning tree. A disconnected graph does not have any spanning tree, as it cannot be
spanned to all its vertices.

We found three spanning trees off one complete graph. A complete undirected graph can have
maximum nn-2 number of spanning trees, where n is the number of nodes. In the above addressed
example, n is 3, hence 33−2 = 3 spanning trees are possible.
General Properties of Spanning Tree:
We now understand that one graph can have more than one spanning tree. Following are a few
properties of the spanning tree connected to graph G −
 A connected graph G can have more than one spanning tree.
 All possible spanning trees of graph G, have the same number of edges and vertices.
 The spanning tree does not have any cycle (loops).
 Removing one edge from the spanning tree will make the graph disconnected, i.e. the
spanning tree is minimally connected.
 Adding one edge to the spanning tree will create a circuit or loop, i.e. the spanning tree
is maximally acyclic.
Application of Spanning Tree:
Spanning tree is basically used to find a minimum path to connect all nodes in a graph. Common
applications of spanning trees are −
 Civil Network Planning
 Computer Network Routing Protocol
 Cluster Analysis
What is Minimum Spanning Tree (MST)? Explain its Algorithms?
Minimum Spanning Tree (MST):In a weighted graph, a minimum spanning tree is a spanning
tree that has minimum weight than all other spanning trees of the same graph. In real-world
situations, this weight can be measured as distance, congestion, traffic load or any arbitrary value
denoted to the edges.
Minimum Spanning-Tree Algorithm:
We shall learn about two most important spanning tree algorithms here −
1. Kruskal's Algorithm
2. Prim's Algorithm
Both are greedy algorithms.
1. Kruskal's Spanning Tree Algorithm:
Kruskal's algorithm is to find the minimum cost spanning tree uses the greedy approach. This
algorithm treats the graph as a forest and every node it has as an individual tree. A tree connects to
another only and only if, it has the least cost among all available options and does not violate MST
properties.
Step-1: To understand Kruskal's algorithm let us consider the following example –

Step-2: Arrange all edges in their increasing order of weight


create a set of edges and weight, and arrange them in an ascending order of weightage (cost).
Step 3: Add the edge which has the least weightage
Now we start adding edges to the graph beginning from the one which has the least weight.

The least cost is 2 and edges involved are B,D and D,T. We add them. Adding them does not violate
spanning tree properties, so we continue to our next edge selection.
Step-4:Next cost is 3, and associated edges are A,C and C,D. We add them again −

Step-5:Next cost in the table is 4, and we observe that adding it will create a circuit in the graph.

Step-6: We ignore it. In the process we shall ignore/avoid all edges that create a circuit.

Step-7:We observe that edges with cost 5 and 6 also create circuits. We ignore them and move on.
Step-8:Now we are left with only one node to be added. Between the two least cost edges available
7 and 8, we shall add the edge with cost 7.

By adding edge S,A we have included all the nodes of the graph and we now have minimum cost
spanning tree.
2. Prim's Spanning Tree Algorithm:
Prim's algorithm is to find minimum cost spanning tree (as Kruskal's algorithm) uses the greedy
approach. Prim's algorithm shares a similarity with the shortest path first algorithms.
Prim's algorithm, in contrast with Kruskal's algorithm, treats the nodes as a single tree and keeps on
adding new nodes to the spanning tree from the given graph.
To contrast with Kruskal's algorithm and to understand Prim's algorithm better, we shall use the
same example –
Step-1: To understand Prim's algorithm let us consider the following example –

Step-2: Choose any arbitrary node as root node


In this case, we choose S node as the root node of Prim's spanning tree. This node is arbitrarily
chosen, so any node can be the root node.
Step 3: Check outgoing edges and select the one with less cost
After choosing the root node S, we see that S,A and S,C are two edges with weight 7 and 8,
respectively. We choose the edge S,A as it is lesser than the other.

Now, the tree S-7-A is treated as one node and we check for all edges going out from it. We select
the one which has the lowest cost and include it in the tree.
Step-4:After this step, S-7-A-3-C tree is formed. Now we'll again treat it as a node and
will check all the edges again. However, we will choose only the least cost edge. In this
case, C-3-D is the new edge, which is less than other edges' cost 8, 6, 4, etc.

Step-5:After adding node D to the spanning tree, we now have two edges going out of
it having the same cost, i.e. D-2-T and D-2-B. Thus, we can add either one. But the
next step will again yield edge 2 as the least cost. Hence, we are showing a spanning
tree with both edges included.

We may find that the output spanning tree of the same graph using two different
algorithms issame.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy