Practice free →
HomeGATE CSEcomputerscienceAlgorithms › BFS finds the shortest path from a source in an …

BFS finds the shortest path from a source in an unweighted graph because

Ait visits vertices in order of edge distance
Bit uses a stack to explore deeply first
Cit sorts edges before traversing them
Dit relaxes edges V−1 times like Bellman-Ford
Answer & Solution
Correct answer: A. it visits vertices in order of edge distance
BFS expands a wavefront from the source, reaching all vertices at distance 1 before any at distance 2, and so on. The first time BFS reaches v is via the fewest edges, so that's the shortest path in unweighted graphs. Stack-based deep exploration is DFS; edge sorting is Kruskal; V−1 relaxations is Bellman-Ford.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions