retagged by
708 views

1 Answer

1 votes
1 votes

Yes, BFS and DFS works for any graph in general. 

There is nothing different in the procedure of bfs/dfs if there's a cycle in the graph. Moreover you can also use DFS to detect cycle in an undirected/directed graph(links given below :))

http://www.geeksforgeeks.org/detect-cycle-in-a-graph/

http://www.geeksforgeeks.org/detect-cycle-undirected-graph/

Related questions

2 votes
2 votes
3 answers
1
rahul sharma 5 asked Dec 15, 2016
700 views
What are some applications where only DFS can be used and BFS can t and vice versa?
1 votes
1 votes
1 answer
3
vaishali jhalani asked Dec 16, 2016
1,430 views
1 votes
1 votes
1 answer
4
komal07 asked May 14, 2015
1,456 views