Cycle Detection using DSU

How did his code work? He did not use the unite function to first make the graph. So, how were the super-parents for nodes given?

@Avi-Kasliwal-315786729062203
he is making the graph parallelly, while taking the input.
whenever input edge is given, it is checked if their superparent is same then cycle else unite them

1 Like