Cycle detection in directed graph using dfs

Please let me know whether my logic for the function dfshelper() is correct or not . This program is for cycle detection in directed graph using dfs.
Here is the link :

Hii Shubham
I have tested your code for various inputs and cross checked your logic.
I find your code to be okay. If you face any problem with any test case anywhere, do let me know. For now your logic is perfectly fine!!

1 Like

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.