GATE CSE 2017 Session 2 Q25: Possible BFS visiting order of a six-node graph
- Algorithms
- 1 mark
- MCQ
- −1/3 if wrong
Syllabus topic: Graph traversals, minimum spanning trees and shortest paths
Question
The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph below?

Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: D (official GATE 2017 final answer key)
Concept used: In BFS every neighbour of the current node is enqueued before any node at a greater distance from the start is visited.
First step: Take each option's first node as the source and check that nodes appear level by level in an order the queue allows.
Full step-by-step solution
Loading…
Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.
More questions on Graph traversals, minimum spanning trees and shortest paths
Every PYQ on this topic →Share this question
Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Algorithms PYQs
- 2026 Session 1 · Q17Solve nested recurrences T1 = 4T1(n/2) + T2, T2 = 5T2(n/4) + log n
- 2026 Session 1 · Q41Shortest paths with at most k edges: two statements
- 2026 Session 1 · Q47Condition forcing a vertex into every minimum vertex cover
- 2026 Session 1 · Q49Cycle and cut properties of MSTs with distinct weights
- 2026 Session 1 · Q50Impossible DFS discovery/finish orderings for a DAG edge
- 2026 Session 1 · Q55Properties of 2-colorable (bipartite) graphs