70 likes | 301 Views
To find Connected components for set of pairs. By Suvarna Khadke. Input (set of pairs…). pairs.txt: Storing these pairs in my data structures as per below diagram 0 1 0 2 0 3 2 5 2 7 4 9 5 8 10 11 10 12. scan each list till end of list
E N D
To find Connected components for set of pairs By Suvarna Khadke
Input (set of pairs…) pairs.txt: Storing these pairs in my data structures as per below diagram • 0 1 • 0 2 • 0 3 • 2 5 • 2 7 • 4 9 • 5 8 • 10 11 • 10 12 scan each list till end of list |HEAD(LinkedList) |-----------------------|------| (next pointer)(Horizontal) 0 4 10 ------|-------- | --|-- | | | | | | 1 2 3 9 11 12 | ----- | | 5 7 | (List pointer (vertical) 8
output • Output will be set of connected components shown below • 0: 0 1 2 3 5 7 8 • 1: 4 9 • 2: 10 11 12
Data structure used for program typedef struct _GLL { struct _GLL *list; //LinkedList for storing connected component int element; struct _GLL *next ; //LinkedList for storing list of connected component } GLL, *PGLL; //pointer to GLL linkedlist