Shortest Paths questions

Q41

GATE CS 2026 CS-1Graph AlgorithmsMCQ2 marks−2/3 if wrong
Let G(V,E)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∈Vs \in V be a vertex in GG. For every u∈Vu \in V and for every k≥0k \ge 0, let dk(u)d_k(u) denote the weight of a shortest path (in terms of weight) from ss to uu of length at most kk. If there is no path from ss to uu of length at most kk, then dk(u)=∞d_k(u) = \infty.

Consider the statements:
S1: For every k≥0k \ge 0 and u∈Vu \in V, dk+1(u)≤dk(u)d_{k+1}(u) \le d_k(u).
S2: For every (u,v)∈E(u, v) \in E, if (u,v)(u, v) is part of a shortest path (in terms of weight) from ss to vv, then for every k≥0k \ge 0, dk(u)≤dk(v)d_k(u) \le d_k(v).

Which one of the following options is correct?
Show answer without attempting

Answer: A

Q37

GATE CS 2026 CS-2Graph AlgorithmsMCQ2 marks−2/3 if wrong
Let GG be a weighted directed acyclic graph with mm edges and nn vertices. Given GG and a source vertex ss in GG, which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from ss to all vertices that are reachable from ss in GG?
Show answer without attempting

Answer: A

0/20 correct0 marks

Related topics in Graph Algorithms