complexitydsagraphs
When is BFS the better graph traversal?
Anonymous
For an unweighted graph, BFS finds shortest paths by edge count because it visits nodes in layers. With an adjacency list, the traversal takes O(V + E) time and up to O(V) extra space. DFS is often a simpler fit when only reachability is needed.
0