GateAI
Graph Traversals

GATE CSE 2024 Set 1 · Q45

MSQ2 marksMedium

Time

Let GG be a directed graph and TT a depth first search (DFS) spanning tree in GG that is rooted at a vertex vv. Suppose TT is also a breadth first search (BFS) tree in GG, rooted at vv. Which of the following statements is/are TRUE for every such graph GG and tree TT ?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified solution

Official answer: C) There are no forward-edges in G with respect to the tree T

Graph Traversals

Let d(u)d(u) denote the shortest path distance from the root vv to any vertex uu in GG. Since TT is a BFS tree rooted at vv, for any vertex uu, the tree-path distance from vv to uu in TT equals d(u)d(u).

  1. Forward-edges: A forward-edge in a DFS tree is a non-tree directed edge (u,w)(u, w) where uu is an ancestor of ww in TT. Because ww is a proper descendant of uu and (u,w)(u, w) is not a tree edge, the distance in TT satisfies:

    d(w)≥d(u)+2d(w) \ge d(u) + 2

    However, if the directed edge (u,w)(u, w) exists in GG, the triangle inequality for shortest path distances requires:

    d(w)≤d(u)+1d(w) \le d(u) + 1

    This is a contradiction. Therefore, no forward-edges can exist in GG with respect to tree TT. Hence, statement (C) is TRUE.

  2. Back-edges and Cross-edges: Back-edges go from a descendant to an ancestor (e.g., creating a directed cycle), which satisfies d(w)≤d(u)+1d(w) \le d(u) + 1 because d(w)<d(u)d(w) < d(u). Cross-edges can also satisfy the shortest path property. Thus, back-edges and cross-edges may exist, making (A), (B), and (D) false in general.

Hence, only C is correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Graph Traversals previous year question is Q45 of the GATE CSE 2024 Set 1 paper. Find more GATE CSE PYQs on Graph Traversals in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Graph Traversals PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Graph Traversals in GATE CSE

Graph Traversals has 16 GATE CSE PYQs across 12 papers from 2014 to 2026. 5 of them are 2-mark MSQs like this one, and it is the only one in GATE CSE 2024 Set 1.

How GATE tests Graph Traversals

More from GATE CSE 2024 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2024 Set 1 · Q45 · MSQ

Let G be a directed graph and T a depth first search (DFS) spanning tree in G that is rooted at a vertex v. Suppose T is also a breadth first search (BFS) tree in G, rooted at v. Which of the following statements is/are TRUE for every such graph G and tree T ?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.