Question: when to use bfs or dfs?
Answer: use BFS - when you want to find the shortest path from a certain source node to a certain destination. ...  use DFS - when you want to exhaust all possibilities, and check which one is the best/count the number of all possible ways.