Can DFS be used to find the shortest path in a graph?

  • No
  • Only in acyclic graphs
  • Only in weighted graphs
  • Yes
No, DFS does not guarantee finding the shortest path in a graph. It can find a path, but it may not be the shortest. BFS is more suitable for finding the shortest path as it explores nodes level by level.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *