Cycle detection in Directed Graph

Can cycle can be detected in a directed graph using Disjoint set and union find algo.
If yes, kindly provide a code for the same.

@mkagrani DSU is used for undirected graphs. There are other algorithms for finding cycle in a directed graph.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.