Cycle detection in graphs

Sir,
In the detection of cycle of directed and undirected graphs you have implemented each of them in different ways. Can we use any of the programs in the implementation of both the cases? If not , please explain what is the difference between the two methods?

@shibashisdolui99 hey we can’t use the same method as in directed graph for cycle detection ,ek node apne parent pr depend nhi krta ,but in undirected graph there is no arrow so a to b is same as b to a therefore hme parent bhi consider krna pdta hai,to islie dono me diffrent concepts use krte hai hm.

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.