Consider the tree arcs of a BFS traversal from a source node in an unweighted, connected, undirected graph. The tree formed by the tree arcs is a data structure for computing
View worked solution
Answer: B
Breadth-First Search (BFS) on an unweighted, connected, undirected graph explores vertices level by level, starting from a source vertex .
During BFS, when we traverse an edge to discover an unvisited vertex, that edge becomes a tree arc. The collection of these tree arcs forms a BFS tree rooted at .
- Shortest Path Property: For any vertex in the graph, the unique path from the root to in the BFS tree has the minimum possible number of edges. Thus, it represents the shortest path from to in the unweighted graph.
- Since the graph is connected, BFS visits every vertex. Therefore, the tree contains the shortest path from to every vertex in the graph.
Analyzing the Options:
- Option A: Incorrect. BFS from a single source only computes shortest paths originating from , not between every arbitrary pair of vertices.
- Option B: Correct. The BFS tree provides the shortest path from the source to all vertices in the graph.
- Option C: Incorrect. The shortest paths are computed for all vertices in the tree, not just the leaf nodes.
- Option D: Incorrect. BFS is not used for finding longest paths.
Free practice · Your answers on this page are not saved.
