GATE CS 2026 · Set-1 · Graph Traversals (BFS & DFS)

MCQ · 2 marks · Problem PROG-GRPH-0038

Let \(G(V, E)\) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path. Let \(s \in V\) be a vertex in \(G\). For every \(u \in V\) and for every \(k \geq 0\), let \(d_{k}(u)\) denote the weight of a shortest path (in terms of weight) from \(s\) to \(u\) of length at most \(k\). If there is no path from \(s\) to \(u\) of length at most \(k\), then \(d_{k}(u)=\infty\). Consider the statements: S1: For every \(k \geq 0\) and \(u \in V, d_{k+1}(u) \leq d_{k}(u)\). S2: For every \((u, v) \in E\), if \((u, v)\) is part of a shortest path (in terms of weight) from \(s\) to \(v\), then for every \(k \geq 0, d_{k}(u) \leq d_{k}(v)\). Which one of the following options is correct?
  1. A
    Only \(\text{S1}\) is true
  2. B
    Only \(\text{S2}\) is true
  3. C
    Both \(\text{S1}\) and \(\text{S2}\) are true
  4. D
    Neither \(\text{S1}\) nor \(\text{S2}\) is true

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option A.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/523049/gate-cse-2026-set-1-question-31

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com