• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE | GATE MOCK 2017 | Question 48

Consider a graph where all edge weights are positive. We have computed shortest path using Dijkstra\'s shortest path algorithm and total weight of shortest path is W. Consider below two statements about a shortest path from a source to a destination.

i) If the graph is modified and all edge weights are multiplied with x, then the shortest path remains same and weight of shortest path becomes W*x (W multiplied by x).
ii) If the graph is modified and x is added to all edge weights, then the shortest path remains same and weight of shortest path becomes W + n*x. Where n is number of edges on the shortest path.

(A)

Only (i) is always True

(B)

Only (ii) is always True

(C)

Both are always True

(D)

Neither (i) nor (ii) is always True

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments