Which traversal algorithm is used in the breadth-first search (BFS) of a graph?

Review the verified answer and explanation for this SPSC – Sindh Public Service Commission past-paper question on CampusFin.

Which traversal algorithm is used in the breadth-first search (BFS) of a graph? Answer: Level-order traversal

• Level-order traversal visits all nodes at the current level of a graph or tree before moving to the next level. This is the same principle as Breadth-First Search (BFS), which explores all neighbors of a node before moving to their neighbors. • BFS uses a queue data structure to achieve this level-by-level traversal. The queue ensures that nodes are processed in a First-In, First-Out (FIFO) manner, so all nodes at a particular depth are visited before moving to the next depth.