Which data structure is used to implement the Breadth-First Search (BFS) traversal of a graph?

  • A Stack
  • B Queue
  • C Hash table
  • D Binary tree

Explanation

BFS explores vertices level by level, so it stores unvisited neighbours in a queue and processes them in FIFO order.