Question

Let G=(V,E)G = (V, E) be a directed, weighted graph with weight function w:E→Rw: E \to \mathbb{R}. For some function f:V→Rf: V \to \mathbb{R}, for each edge (u,v)∈E(u, v) \in E, define w′(u,v)w'(u, v) as w(u,v)+f(u)−f(v)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 GG under ww are shortest paths under w′w' too, _______"

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2020 answer key

Solution

Analyze how telescoping sums affect the total weight of any path under Johnson's reweighting scheme.

Let P=⟨v0,v1,…,vk⟩P = \langle v_0, v_1, \dots, v_k \rangle be any directed path from vertex u=v0u = v_0 to vertex v=vkv = v_k in GG.

Compute the path weight under w′w':

w′(P)=∑i=1kw′(vi−1,vi)=∑i=1k[w(vi−1,vi)+f(vi−1)−f(vi)]w'(P) = \sum_{i=1}^{k} w'(v_{i-1}, v_i) = \sum_{i=1}^{k} [w(v_{i-1}, v_i) + f(v_{i-1}) - f(v_i)]

Using the telescoping property of the sum:

∑i=1k[f(vi−1)−f(vi)]=f(v0)−f(vk)=f(u)−f(v)\sum_{i=1}^{k} [f(v_{i-1}) - f(v_i)] = f(v_0) - f(v_k) = f(u) - f(v)

Thus:

w′(P)=w(P)+f(u)−f(v)w'(P) = w(P) + f(u) - f(v)

Significance of the result:

  • For any fixed pair of endpoints uu and vv, the quantity f(u)−f(v)f(u) - f(v) is an identical constant for EVERY path connecting uu to vv.
  • Therefore, a path PP minimizes w(P)w(P) if and only if it minimizes w′(P)=w(P)+f(u)−f(v)w'(P) = w(P) + f(u) - f(v).
  • This holds for every function f:V→Rf: V \to \mathbb{R}, without needing any positivity, negativity, or shortest-path distance constraints on ff.
Final answer

A

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2020 Computer Science and Information Technology (CS)
Question
50 of 65, printed as CS Q.40
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.