DAA_Lab-12_Program-1
DAA_Lab-12_Program-1
#include <stdlib.h>
} Edge;
int V, E;
Edge edges[MAX_EDGES];
} Graph;
} Subset;
graph->V = V;
graph->E = E;
return graph;
if (subsets[i].parent != i) {
return subsets[i].parent;
}
void Union(Subset subsets[], int x, int y) {
subsets[xroot].parent = yroot;
subsets[yroot].parent = xroot;
} else {
subsets[yroot].parent = xroot;
subsets[xroot].rank++;
Edge mst[graph->V];
int e = 0, i = 0;
subsets[v].parent = v;
subsets[v].rank = 0;
if (x != y) {
mst[e++] = next_edge;
Union(subsets, x, y);
int main() {
int V, E;
kruskalMST(graph);
return 0;