Why DFS and not BFS for finding cycle in graphs.

Posted by badcompany on Stack Overflow See other posts from Stack Overflow or by badcompany
Published on 2010-05-19T21:42:54Z Indexed on 2010/05/19 21:50 UTC
Read the original article Hit count: 265

Filed under:
|

Predominantly DFS is used to find a cycle in graphs and not BFS. Any reasons? Both can find if a node has already been visited while traversing the tree/graph.

© Stack Overflow or respective owner

Related posts about graphs

Related posts about algorithm