GATE / CS ARCHIVE

SIMILAR QUESTIONS / ALGORITHMS

Compare MST and path behavior after uniform edge increases

3 questions solved the same way, newest first. Back to Algorithms

How these are solved

Every spanning tree has V−1 edges, so adding the same constant preserves all minimizers; paths may have different hop counts and can change order. 2015 asks only the numerical MST total after adding5, whereas 2016 and2025 contrast MST and shortest paths.

2 marks · MCQ
Report issue

Graph Algorithms

Question 37, GATE 2025: In an undirected graph with positive edge weights, add the same positive constant α to every edge. How are minimum spanning trees (MSTs) and shortest paths (SPs) affected?
A. Every MST and every SP remain optimal.
B. MSTs may change; every SP remains optimal.
C. Every MST remains optimal; SPs may change.
D. Both MSTs and SPs may change.
Consider components where the corresponding spanning tree/path exists.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

For a graph with n vertices, every spanning tree uses exactly n−1 edges. Its new weight is w'(T)=w(T)+(n−1)α. Any two trees receive exactly the same increment, so their weight difference and ordering are unchanged. In particular, every old MST is still an MST, and ties between MSTs are preserved.

Paths do not all contain the same number of edges. Consider a triangle with u–w of weight 1, w–v of weight 1, and u–v of weight 3. Initially the two-edge route from u to v costs 2, beating the direct edge's 3. Add α=2 to every edge. The two-edge route now costs 3+3=6, whereas the direct edge costs 5, so the old shortest path is no longer shortest.

Thus constant addition preserves MSTs but need not preserve shortest paths: C. The distinction is a fixed edge count across all spanning trees versus a potentially variable edge count across paths. Multiplying every edge by a positive constant would preserve both, but that is a different operation.

Original paper, page 28 · Answer key

1 mark · MCQ
Report issue

Graph Algorithms

Question 14, GATE 2016: In a connected weighted undirected graph with distinct positive edge weights, add the same positive amount to every edge weight. Evaluate P: the minimum spanning tree is unchanged; Q: the shortest path between every pair is unchanged. A: P only. B: Q only. C: neither. D: both.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Every spanning tree has |V|−1 edges, so adding a constant c to each edge adds the same c(|V|−1) to every tree’s weight, preserving the unique MST. Paths may have different edge counts: triangle weights 1, 2, 4 initially favor 1+2 over 4, but adding 2 makes the direct 6 shorter than 3+4. Thus only P, A.

The invariant for trees is equal edge count, not merely preserved ordering of individual edge weights. Compare two trees T1,T2: the added terms cancel in their weight difference. By contrast a k-edge path gains kc, and another path with fewer edges gains less. The triangle counterexample demonstrates an actual reversal while retaining positive, distinct edge weights, so Q fails as a universal statement even though some particular graphs keep their shortest paths.

Original paper, page 7 · Answer key

2 marks · NAT
Report issue

Graph Algorithms

Question 55, GATE 2015: A connected undirected graph G has 100 vertices and 300 edges. The weight of a minimum spanning tree is 500. If the weight of every edge in G is increased by 5, what is the new minimum spanning-tree weight?
Tap to enlarge
Answer & solution

Official answer: 995

1. The 300 graph edges do not all belong to the spanning tree. Connectedness makes every spanning tree have exactly |V|−1=99 edges, so the increment is 99·5 rather than 300·5. Because all candidate trees receive the same increment, a previously minimum tree remains minimum.

2. Every spanning tree on 100 vertices has 99 edges. Adding5 to every edge increases every spanning-tree weight by exactly 495, preserving their ordering and the set of minimum spanning trees. The new minimum weight is 500+495=995.

Original paper, page 75 · Answer key