SyntaxFix
Write A Post
Hire A Developer
Questions
The way I do it is to do a Topological Sort, counting the number of vertices visited. If that number is less than the total number of vertices in the DAG, you have a cycle.