IAE Academy

GATE 2025 CS1 Q.43: solution and answer

GATE 2025 · CS1Q.43 · 2 marks · MCQ

Let be an undirected and unweighted graph with 100 vertices. Let denote the number of edges in a shortest path between vertices and in . Let the maximum value of , such that , be 30. Let be any breadth-first-search tree of . Which ONE of the given options is CORRECT for every such graph ?

  1. (A)

    The height of is exactly 15.

  2. (B)

    The height of is exactly 30.

  3. (C)

    The height of is at least 15.

  4. (D)

    The height of is at least 30.

See the question in the paper

Answer and solution

ANSWER

The correct answer is (C): The height of is at least 15, for every BFS tree of every such graph .

Official answer: CSource: Official answer key, GATE 2025 CS1 (IIT Roorkee)

  1. Let , achieved by some pair of vertices .

  2. For any root , the breadth-first-search tree rooted at has height , the eccentricity of — because BFS discovers vertices in strictly increasing order of distance from , so the deepest tree level is exactly the farthest distance from .

  3. By the triangle inequality on shortest-path distances: .

  4. Since is any vertex, both and , so .

  5. Substituting : , hence — and this holds for every root , so for every BFS tree of , and for every graph satisfying the given diameter condition.

  6. Checking the bound is not improvable to equality or to 30 for every case: choosing to be a 'central' vertex (minimizing eccentricity) can make exactly, which already rules out option (D) ('at least 30') since . Choosing to be a diametral endpoint gives , which rules out option (A) ('exactly 15') and option (B) ('exactly 30'), since different roots on the same graph give different heights (15 vs 30).

  7. Only option (C), , is a statement that holds for every such graph and every BFS tree of it.

KEY IDEA

See keyIdea field above.

WATCH OUT FOR

See commonMistake field above.

From the GATE 2025 CS1 paper. Every question of this paper · Download the full paper · All 28 Graph algorithms questions, with notes

More Graph algorithms questions