there is some error in my code
what?
Graph 13- Cycle Detection in Directed Graph using DFS
Hello @khemchandrs,
There are three mistakes in your code:
-
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) -
Next two errors were in the iterator.
Modified Code:
Hope, this will help.
Give a like if you are satisfied.