0
$\begingroup$

I am trying to figure out what kinds of graphs are better suited to BFS and which are better suited to DFS. However i'm struggling to visualise what kind of graphs favour which search. Could someone give some simple graph examples and explain which search strategy would be more efficient/faster for the given graph?

$\endgroup$
3
  • 1
    $\begingroup$ You need to formalize what you mean by "favours". $\endgroup$
    – Vladislav
    Commented Mar 8, 2020 at 15:48
  • $\begingroup$ By favours I mean, which search strategy would be more efficient and search through the given graph faster. $\endgroup$ Commented Mar 8, 2020 at 16:00
  • 2
    $\begingroup$ If you allow infinite graphs then BFS doesn't find every vertex on trees with an infinite branching degree and DFS doesn't on trees with infinite depth $\endgroup$
    – Daniel
    Commented Mar 8, 2020 at 17:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.