Kruskal's Algorithm - Minimum Cost Spanning Tree

Kruskal's Algorithm - Minimum Cost Spanning Tree

C.S.E-Pathshala by Nirmal Gaud

4 года назад

183 Просмотров

Kruskal's algorithm is a minimum spanning tree algorithm that takes a graph as input and finds the subset of the edges of that graph which form a tree that includes every vertex has the minimum sum of weights among all the trees that can be formed from the graph. It falls under a class of algorithms called greedy algorithms that find the local optimum in the hopes of finding a global optimum. We start from the edges with the lowest weight and keep adding edges until we reach our goal.The steps for implementing Kruskal's algorithm are as follows:
1.Sort all the edges from low weight to high
2. Take the edge with the lowest weight and add it to the spanning tree. If adding the edge created a cycle, then reject this edge.
3. Keep adding edges until we reach all vertices.

Тэги:

##kruskal ##spanningtree
Ссылки и html тэги не поддерживаются


Комментарии: