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 ?
GATE CSE 2025Algorithms › Graph AlgorithmsVerified
GATE CSE 2025 PYQ: Let G ( V , E ) G(V, E) G ( V , E ) be an undirected and unweighted graph with 100 100 100 vertices. Let d (…
- AThe height of is exactly 15.
- BThe height of is exactly 30.
- CThe height of is at least 15.Correct answer
- DThe height of is at least 30.
Answer
(C) The height of T T T is at least 15 15 15 .
Approach
The condition says the graph has diameter 30: there exist vertices u,v with d(u,v)=30. For any BFS root r, the height of the BFS tree is the maximum distance from r to any vertex, i.e. the eccentricity of r. Using the triangle inequality, 30 = d(u,v) ≤ d(r,u)+d(r,v), so at least one of u or v is at distance at least 15 from r. Hence every BFS tree has height at least 15, and this bound is tight when the root is chosen midway between a diametral pair.
For every graph with diameter 30, any BFS tree rooted at any vertex has height at least ceil(30/2)=15, because a diametral pair cannot both be closer than 15 to the root. The height can be 15 or 30 depending on the root, so only 'at least 15' is correct.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.