Question
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 . Let be any breadth-first-search tree of . Which ONE of the given options is CORRECT for every such graph ?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2025 answer key
Solution
Apply the triangle inequality to the BFS root and a pair of diametrically opposite vertices with .
Let be two vertices that achieve the diameter of , so . Let be the root of the breadth-first-search (BFS) tree . Since BFS from finds shortest paths in an unweighted graph, the depth of any vertex in is , and the height of is .
By the triangle inequality:
Dividing by 2 gives . (Depending on the choice of root , can be any integer from to , e.g., when is the midpoint of a length-30 path, or when is an endpoint.) Thus the height of is at least 15.
Option (C)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 43 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.