Graph Algorithms

Answer & solution
Official answer: A
Givens and goal
In an undirected integer-weighted graph, dk(u) is the minimum weight of an s-to-u path with at most k edges, or infinity if none exists. S1 says dk+1(u)≤dk(u). S2 says that if edge (u,v) lies on a shortest s-to-v path, then dk(u)≤dk(v) for every k. Classify S1 and S2.
Approach
Compare nested feasible path sets for S1 and use an explicit small edge-budget counterexample for S2.
Step-by-step solution
1. Every path using at most k edges also uses at most k+1 edges. The feasible set for dk(u) is therefore contained in the feasible set for dk+1(u).
2. Minimizing over a larger set cannot increase the minimum. Hence dk+1(u)≤dk(u), including the situation where an unavailable path of value infinity becomes available. S1 is true without assuming positive weights.
3. For S2, consider four vertices s,a,u,v with edges s—a of weight 1, a—u of weight 1, u—v of weight 1, and s—v of weight 10. The shortest s-to-v path is s—a—u—v, of total weight 3, and it includes (u,v).
4. Impose budget k=1. There is no one-edge s-to-u path, so d₁(u)=∞. But the direct edge s—v is permitted, giving d₁(v)=10. The asserted inequality ∞≤10 is false.
5. Thus only S1 holds, option A. Being a prefix of an unrestricted shortest path does not imply being reachable under the same smaller edge budget. The counterexample uses strictly positive integer weights, so the failure does not depend on negative cycles or an ambiguity about repeated vertices.