Prims and Kruskals Algorithms

 Explanation Video : We can find spanning trees for connected graphs only.

Prims Algorithm : Select smallest weight edge and always select connected smallest one.

Kruskals Algorithms : Select all (connected or not connected) minimum cost edges that don't form a circle and form a tree. It may find minimum weight tree from the given unconnected graph but that may not be spanning tree.

Find missing edge
In a given graph there can be more than one spanning trees that gives optimum result but there can be only one optimum result for spanning tree in a given graph.

Comments

Popular posts from this blog

SQL basic interview question

gsutil Vs Storage Transfer Service Vs Transfer Appliance