Amazon interview question

For any problem how to decide which algorithm to use from BFS and DFS?