GATE CS 2020 · Question 50 · Algorithms · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

Let G=(V,E) be a directed, weighted graph with weight function w: E → ℝ. For some function f: V → ℝ, for each edge (u,v) ∈ E, define w'(u,v) as w(u,v) + f(u) - f(v).
Which one of the options completes the following sentence so that it is TRUE?
“The shortest paths in G under w are shortest paths under w' too, ______”.

  1. (A) for every f: V → ℝ
  2. (B) if and only if ∀ u ∈ V, f(u) is positive
  3. (C) if and only if ∀ u ∈ V, f(u) is negative
  4. (D) if and only if f(u) is the distance from s to u in the graph obtained by adding a new vertex s to G and edges of zero weight from s to every vertex of G
Answer

Answer (A)

Answer from the official GATE CS 2020 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes