A spanning tree is a sub-graph of an undirected connected graph, which includes all the vertices of the graph. If this sub-graph is achieved with minimum cost edges then it is said to be minimum spanning tree (MST)
A greedy algorithm is an algorithm that is generally used in optimization problems. This algorithm makes the least expensive choice at each step and assumes that in this way the total cost of solving the entire problem would be minimum.
Lets develop good understanding of the following topics. [Click the following links to watch the video]
- Graph Introduction
- introduction to Greedy Algorithms
- Solving 0/1 and Fractional knapsack problem using Greedy Approach
- Understanding Minimum Spanning Tree (MST)
- Finding MST using Krushal Algorithm with an example
- Prims Method to find Minimum Spanning Tree (MST)
- Example of finding MST using Prim’s and Krushkal’s
- Analysis of Kruskals Algorithm
- Analysis of Prims Algorithm
You are invited to raise queries by writing your question in the box given below
According to the Kruskal algorithm that was given in the video, it is clearly seen that the final set A should consist of tuples of vertices, that make an edge, but in the example set A holds only vertices. However, professor used set A for condition in FIND-SET(u) != FIND-SET(v), and crossed the set of particular vertex if it was used to check condition. Moreover, the UNION function was not used.
I think professor should not have used A set in condition, instead it needed to keep only chosen edges, whereas UNION function update particular vertex set( u = UNION(u, v), and delete set v, for following conditions.
By doing this, returned set will be more meaningful, that holds edges to form minimum spanning tree
Your concern is obvious, Actually in the example, the edges which are shown in the table and crossed out during the execution of algorithm are added in set A, Moreover, the vertices which are shown in set A are also needed to check the vertices included in the spanning tree.