Minimum Spanning Tree
Explore how to find the minimum spanning tree (MST) of a connected, weighted, undirected graph using Prim's algorithm. Understand MST concepts, step through the algorithm to build the tree, and analyze the time and space complexity of the solution.
We'll cover the following...
We'll cover the following...
Statement
Find the
Example
Consider the following graph:
The minimum spanning tree of the above graph is:
Sample input
Input will be a graph of the form:
v = 5
e = [ [ 1, 2, 1 ],
[ 1, 3, 1 ],
[ 2, 3, 2 ],
[ 2, 4, 3 ],
[ 3, 5, 3 ],
[ 4, 5, 2 ] ]
where is the number of edges, and is the set of weighted edges. Each edge is coded as follows: ...