Skip to content
Official PYQ · 2006

GATE CS 2006 Q48 — Graph Traversals (BFS, DFS)

Explain with AI

Let TT be a depth first search tree in an undirected graph GG. Vertices uu and νν are leaves of this tree TT. The degrees of both uu and νν in GG are at least 22. which one of the following statements is true?

Choose one option
View worked solution

Answer: D

In a Depth First Search (DFS) tree TT of an undirected graph GG, every edge of GG is either a tree edge or a back edge. There are no cross edges.

Let uu be a leaf of TT. Since uu is a leaf, its only tree edge is to its parent. Any other edge incident on uu in GG must be a back edge. Because there are no cross edges, all back edges from uu must connect to its ancestors in TT.

Therefore, all neighbors of uu in GG are ancestors of uu in TT. Since the ancestors of any vertex in a tree lie on a single unique path from the root to that vertex, all neighbors of uu must lie on the path in TT from the root to uu.

Let ww be the neighbor of uu that is closest to the root of TT. The path in TT from ww to uu contains all neighbors of uu. By adding the edge (u,w)(u, w) to this path, we obtain a cycle in GG that contains uu and all of its neighbors. Thus, Option D is always true.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Graph Traversals (BFS, DFS) questions