An algorithm to find a MST from a Weighted Graph
Algorithm
- Keep finding the minimum edges that donāt result in a Cycle for the MST
- Do it againā¦
Storing Cluster
- Each cluster is a linked list
- Merging two clusters is merging two linked lists
Complexity
- Collecting and storing edges
- Cluster updates (with Linked List) per vertex, in total
- Total time is
Pseudocode
T := new container for edges
L := edges stored in non-decreasing order by weight
for each vertex v:
v.cluster := make-cluster(v)
for each (u,v) in L:
if u.cluster != v.cluster:
T.add( (u,v) )
merge u.cluster and v.cluster
return T