GateAI
Graph Traversals

GATE CSE 2015 Set 1 · Q45

MCQ2 marksMedium

Time

Let G=(V,E)G = (V, E) be a simple undirected graph, and ss be a particular vertex in it called the source. For x∈Vx \in V, let d(x)d(x) denote the shortest distance in GG from ss to xx. A breadth first search (BFS) is performed starting at ss. Let TT be the resultant BFS tree. If (u,v)(u,v) is an edge of GG that is not in TT, then which one of the following CANNOT be the value of d(u)−d(v)d(u) - d(v)?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) 2

Graph Traversals

In an unweighted, undirected graph G=(V,E)G = (V, E), the shortest path distance from a source vertex ss satisfies the triangle inequality for every edge (u,v)∈E(u, v) \in E:

∣d(u)−d(v)∣≤1|d(u) - d(v)| \le 1

This means that for any edge (u,v)(u, v) in GG (whether it belongs to the BFS tree TT or is a cross/non-tree edge), the distance labels of uu and vv can differ by at most 11. Thus, the possible values of d(u)−d(v)d(u) - d(v) are strictly:

d(u)−d(v)∈{−1,0,1}d(u) - d(v) \in \{-1, 0, 1\}

Therefore, $d(u) - d(v)$CANNOT be 22.

Hence, the correct option is (D).

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 2015 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. 2 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 1.

How GATE tests Graph Traversals

More from GATE CSE 2015 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2015 Set 1 · Q45 · MCQ

Let G = (V, E) be a simple undirected graph, and s be a particular vertex in it called the source. For x ∈ V, let d(x) denote the shortest distance in G from s to x. A breadth first search (BFS) is performed starting at s. Let T be the resultant BFS tree. If (u,v) is an edge of G that is not in T, then which one of the following CANNOT be the value of d(u) - d(v)?

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.