Detecting cycles in a Directed Graph using BFS?

Правка en2, от MedoN11, 2015-06-23 08:09:54

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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский MedoN11 2015-06-23 08:09:54 13
en1 Английский MedoN11 2015-06-23 08:03:40 456 Initial revision (published)