Graph 13- Cycle Detection in Directed Graph using DFS


there is some error in my code
what?

Hello @khemchandrs,

There are three mistakes in your code:

  1. As you set biDirec to a default value of true.
    So, your code will form a bidirectional graph forming cycles in your graph.
    Solution:
    1.1. either pass third parameter as false
    1.1. or make the default value false (i have done this modification)

  2. Next two errors were in the iterator.

Modified Code:

Hope, this will help.
Give a like if you are satisfied.