Question: can dfs find shortest path?
Answer: DFS does not necessarily yield shortest paths in an undirected graph. ... If you try to find the shortest path from one node to another using DFS, then you will get the wrong answer unless you follow the edge directly connecting the start and destination nodes.