Which graph traversal guarantees visiting all vertices at the current depth before moving to the next level?
14 views
- Depth-First Search (DFS)
- Breadth-First Search (BFS) (Correct Answer)
- Dijkstra’s Algorithm
- Bellman-Ford Algorithm
Explanation
BFS uses a queue to explore all vertices at the current depth level before moving deeper, making it ideal for shortest-path in unweighted graphs. DFS uses a stack/recursion and goes deep first.