GATE CS 2020 · Graph Traversals (BFS & DFS)

MCQ · 2 marks · Problem PROG-GRPH-0054

Let \(G=(V,E)\) be a directed, weighed graph with weight function \(w:E\rightarrow \mathbb{R}\). For some function \(f:V\rightarrow \mathbb{R}\), for each edge \((u,v) \in 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\rightarrow \mathbb{R}\)
  2. B
    if and only if \(\forall u \in V,f(u)\) is positive
  3. C
    if and only if \(\forall u \in 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 verex of G

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option A.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/333191/gate2020-cs-40

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com