Disjoint set: This class provides the find and union operations used to detect cycles.
Kruskal's Algorithm: First, we convert the adjacency list to a list of edges, we then sort the edges by weight, Using the disjoint set, we process the edges and add them to the MST if they do not form a cycle
Input Graph: The input graph() function accepts the user input to define the adjacency list graph.