How to distinguish between bfs and dfs, the main difference between the two:
dfs: It is a brute force method to search out all paths (recursive layer by layer), that is, all solutions are included;
bfs: Suitable for optimal solution problems, such as the shortest path, because the solution obtained by bfs closest to the root of the tree must be optimal;