Related Articles

Related Articles

GATE | GATE-CS-2016 (Set 1) | Question 24
  • Last Updated : 12 Feb, 2016

Let G be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increased by the same value, then which of the following statements is/are TRUE?

P: Minimum spanning tree of G does not change
Q: Shortest path between any pair of vertices does not change

(A) P only

(B) Q only
(C) Neither P nor Q
(D) Both P and Q


Answer: (A)

Explanation: The shortest path may change. The reason is, there may be different number of edges in different paths from s to t. For example, let shortest path be of weight 15 and has 5 edges. Let there be another path with 2 edges and total weight 25. The weight of the shortest path is increased by 5*10 and becomes 15 + 50. Weight of the other path is increased by 2*10 and becomes 25 + 20. So the shortest path changes to the other path with weight as 45.

The Minimum Spanning Tree doesn’t change. Remember the Kruskal’s algorithm where we sort the edges first. IF we increase all weights, then order of edges won’t change.

Quiz of this Question
Please comment below if you find anything wrong in the above post

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :