Kruskal algorithm is used to find the shortest path between two points in a connected weighted graph. This algorithm comes under greedy technique. This algorithm used to find the minimum cost of spanning tree. It converts the given graph into spanning tree considering each node as a separate tree. While…