GATE CS 2001 · Graph Traversals (BFS & DFS)

MCQ · 1 mark · Problem PROG-GRPH-0124

Consider the undirected unweighted graph G. Let a breadth-first traversal of G be done starting from a node r . Let d(r,u) and d(r,v) be the lengths of the shortest paths form r to u and v respectively in G. If u is visited before v during the breadth-first traversal, which of the following statements is correct ?
  1. A
    d(r,u) \(\lt\) d(r,v)
  2. B
    d(r,u) \(\leq\) d(r,v)
  3. C
    d(r,u) \(\gt\)d(r,v)
  4. D
    None of the above

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option B.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/732/gate2001-2-14

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com