GATE 2014 CS (CS2) – Question 24
A BFS from W in an unweighted connected undirected graph gives tree T. T is a data structure for computing ______.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) shortest paths from W to every vertex
Explanation
BFS discovers vertices in nondecreasing distance from its source in an unweighted graph. Each tree path from W therefore has the minimum number of edges to that vertex. Thus **B**, shortest paths from W to every vertex. It does not simultaneously preserve all-pairs shortest paths.