Skip to main content

GATE CSE 2006Algorithms › Graph AlgorithmsVerified

GATE CSE 2006 PYQ: Let T T T be a depth first search tree in an undirected graph G G G . Vertices u u u and ν ν ν are leaves of…

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 2. which one of the following statements is true?

  1. A
    There must exist a vertex ww adjacent to both uu and νν in GG
  2. B
    There must exist a vertex ww whose removal disconnects uu and νν in GG
  3. C
    There must exist a cycle in GG containing uu and νν
  4. D
    There must exist a cycle in GG containing uu and all its neighbours in GG
    Correct answer

Answer

(D) There must exist a cycle in G G G containing u u u and all its neighbours in G G G

Approach

Use the standard property of DFS on undirected graphs: every non-tree edge is a back edge joining a vertex to an ancestor. Since u is a leaf of the DFS tree T, the only tree edge incident to u is to its parent; all other neighbours of u in G are therefore ancestors of u. The ancestors of u in T form a single chain, and the highest such ancestor adjacent to u gives a cycle that includes u and all its neighbours.

In an undirected DFS tree, a leaf u has only its parent as a tree neighbour, and all other neighbours are ancestors. Because deg(u) >= 2, at least one ancestor is connected to u by a back edge. The tree path from that ancestor to u plus the back edge forms a cycle that necessarily includes every neighbour of u. Hence option D is the only forced statement.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.