Computer Sciences > GATE 2025 SET-1 > Graph Algorithms
Let G(V,E) be an undirected and unweighted graph with 100 vertices. Let d(u,v) denote the number of edges in a shortest path between vertices u and v in V. Let the maximum value of d(u,v) u, v∈V such that u≠v, be 30. Let T be any breadth-first-search tree of G. Which ONE of the given options is CORRECT for every such graph G?
Correct : c
Explaination:
- Diameter of G =
max_{u,v} d(u,v)= 30. - Define the radius of G as
rad(G) = min_{x} max_{y} d(x,y). It is always true thatrad(G) ≤ diam(G) ≤ 2 · rad(G). - From
diam(G) = 30we getrad(G) ≥ ⌈30/2⌉ = 15. - For any root
r, a BFS tree T rooted atrhas height equal to the eccentricity ofr, i.e.height(T) = max_{v} d(r,v)which is ≥rad(G). - Therefore for every BFS tree
Twe haveheight(T) ≥ rad(G) ≥ 15. Hence the height is at least 15.
Why other options are wrong (quick examples):
- A (exactly 15): Not guaranteed — if you root at an endpoint of a diameter pair, the BFS tree height can be 30.
- B (exactly 30): Not guaranteed — if you pick a center vertex (when
rad(G)=15), a BFS tree can have height 15. - D (at least 30): False — some BFS trees can have height 15, so "at least 30" is not true for every BFS tree.
Concrete illustrations:
- Take a simple path of 31 vertices (a path graph of length 30). Its diameter is 30. A BFS tree rooted at an endpoint has height 30; a BFS tree rooted at the middle vertex has height 15.
Similar Questions
Let G be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant a is added to the weight of every edge. Which ONE of the foll...
Consider the following algorithm someAlgo that takes an undirected graph G as input.
The output of someAlgo (T) for the tree shown in the given figure is _____...
Let G(V, E) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of...
Total Unique Visitors
Loading......