SNGRAPH - Editorial

Can someone please explain why is N= 1e5 + 5 in the solution provided in the editorial?

Someone please explain the functions in code given in editorial.I have just studied the concept of DSU and its working.Looking for implementation.

I have taken a n*n matrix whose entry is 1 if there is an edge between I+1 and j+1 node,0 otherwise.I use the way node to see how many nodes it can communicate with and add an edge between a non communicable node and increment the value of no. of edges required.

thank you senbihan :slight_smile: