Detecting cycles in a DAG using BFS?

Revision en1, by MedoN11, 2015-06-23 08:03:40

Yes, I know there is a simple detection algorithm using DFS, but assume for a certain application, I'm interesting in doing via breadth first search traversal, is it possible to do so? I've only seen confirmations about that on quora but without psuedo code or any details.

What is the most efficient way to do so? and if possible, can someone please supply a code? ( A simple short pseudo code is enough).

Thanks.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English MedoN11 2015-06-23 08:09:54 13
en1 English MedoN11 2015-06-23 08:03:40 456 Initial revision (published)