0% found this document useful (0 votes)
52 views

Introduction Application of MST MST Construction Using Prims Algorithm Prim's Algorithm Time Complexity Analysis

Here are the steps to construct the MST for the given graph using Prim's algorithm: 1. Choose any vertex as the starting vertex, say vertex 1. 2. The edge with the minimum weight connected to the vertex 1 is the edge between vertex 1 and 2 with weight 5. Include this edge in the MST. 3. Now the vertices included in the MST are 1 and 2. The minimum weight edge connected from these vertices is the edge between vertex 1 and 3 with weight 7. Include this edge. 4. Now the vertices included are 1, 2 and 3. The minimum weight edge is between vertex 2 and 4 with weight 8. Include this. 5. Now the vertices

Uploaded by

revathi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Introduction Application of MST MST Construction Using Prims Algorithm Prim's Algorithm Time Complexity Analysis

Here are the steps to construct the MST for the given graph using Prim's algorithm: 1. Choose any vertex as the starting vertex, say vertex 1. 2. The edge with the minimum weight connected to the vertex 1 is the edge between vertex 1 and 2 with weight 5. Include this edge in the MST. 3. Now the vertices included in the MST are 1 and 2. The minimum weight edge connected from these vertices is the edge between vertex 1 and 3 with weight 7. Include this edge. 4. Now the vertices included are 1, 2 and 3. The minimum weight edge is between vertex 2 and 4 with weight 8. Include this. 5. Now the vertices

Uploaded by

revathi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Prim’s Algorithm

 Introduction
 Application of MST
 MST construction using Prims algorithm
 Prim’s Algorithm
 Time complexity Analysis
Introduction
• Prim’s algorithm is used to find the Minimum Spanning Tree (MST) of a
given graph. The graph must be weighted, connected and undirected.
• A spanning tree is a subset of Graph G, which has all the vertices covered
with minimum possible number of edges..
• Spanning tree must not contain any cycle and all vertices must be connected.
• For a given weighted graph, many number of spanning trees are possible.
Minimum spanning tree is a one which has minimum weight than all other
spanning trees of the same graph.
• A minimum spanning tree has (V – 1) edges where V is the number of
vertices in the given graph.
Example

Saveetha Engii
Application
 Consider telecommunications company trying to lay cable in a new
neighborhood. It can bury the cable from one of the near by house. Some
of the paths might be more expensive, because they may be longer, or
require the cable to be buried deeper.

•  A minimum spanning tree would give solution by finding least


expensive path for laying the cable.
• More application: Civil Network Planning
Computer Network Routing Protocol
Cluster Analysis
Greedy Algorithm to construct MST
Step-1: Randomly choose any vertex.
The vertex connecting to the edge having least weight is
usually selected.
 Step-02: Find all the edges that connect the tree to new vertices.
Find the least weight edge among those edges and include it in
the existing tree.
If including that edge creates a cycle, then reject that edge and
look for the next least weight edge.
 Step-03: Repeating step-2 until all the vertices are included and
Minimum Spanning Tree. MST is obtained.
Construct MST for the given graph using Prims algorithm
•C
Since all the vertices
have been included in
the MST, so we stop.
Assignment
Construct MST for the following graph using Prims algorithm

You might also like