isCyclic Graph problem

right now my code gives 0 if not cyclic and 1 if cyclic,
can you modify this code to get the nodes that formes the cycles?


Please refer to this link.

sorry forgot to mention, I was talking about directed graphs. can you make changes to my code?


These links would help. Step by step implementation is given in the second link. Please try to implement that.

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.