Question
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?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2026 answer key
Solution
Check monotonicity of in (S1) and test S2 when a shorter-hop path to exists or when edge weights are negative.
- S1 is true: Let be the set of paths from to of length at most . Since , taking the minimum path weight over a larger set of allowed paths can only decrease or keep the minimum unchanged: .
- S2 is false: Consider a graph with vertices and edges of weight , of weight , of weight , and a direct edge of weight . The unique shortest path from to in terms of weight is (weight , length ), which contains . However, for , there is a 1-edge path from to of weight (), whereas there is no path from to of length at most (). (Moreover, if has a negative integer weight, can also be strictly less than .)
Option (A)
Assuming holds for every just because holds for unconstrained non-negative shortest paths.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2026 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 41 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.