Let 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 be a vertex in . For every and for every , let denote the weight of a shortest path (in terms of weight) from to of length at most . If there is no path from to of length at most , then .
Consider the statements:
S1: For every and .
S2: For every , if is part of a shortest path (in terms of weight) from to , then for every .
Which one of the following options is correct?
GATE CSE 2026Algorithms › Graph AlgorithmsVerified
GATE CSE 2026 PYQ: Let G ( V , E ) G(V, E) G ( V , E ) be an undirected, edge-weighted graph with integer weights. The weight…
- AOnly is trueCorrect answer
- BOnly is true
- CBoth and are true
- DNeither nor is true
Answer
(A) Only S1 \text{S1} S1 is true
Approach
S1 follows because increasing the allowed path length from k to k+1 expands the set of candidate paths, so the minimum weight cannot increase. For S2, construct a small counterexample where (u,v) lies on a shortest s-v path, but for some k the restricted shortest distance to u is larger than that to v, making S2 false.
Statement S1 is true because $d_k(u)$ is non-increasing as k increases. Statement S2 is false; in the given counterexample, (u,v) lies on a shortest path from s to v, but for k=1 we have $d_1(u)=∞$ and $d_1(v)=10$, violating $d_k(u)≤d_k(v)$. Hence only S1 is true, so the correct option is A.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.