February 2020
Beginner to intermediate
616 pages
15h 16m
English
Consider the following undirected graph:

Because the graph has five vertices, the minimum spanning tree will have four edges. The first step in Kruskal's algorithm is that the edges of the graph are first sorted in ascending order of their weights:
Weight Src Dest 1 1 2 1 3 5 2 1 5 2 2 5 2 3 4 3 1 3 3 2 4 4 4 5
Now, we will pick up one edge at a time from the preceding table, and, if it does not make a cycle, we will include it in the minimum spanning tree. We begin with edge (1,2). There is no cycle in this edge; therefore, it is included in the minimum spanning tree as follows:
The next edge in ...
Read now
Unlock full access