Computer Sciences > GATE 2025 SET-2 > Graph Algorithms
Let G be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant a is added to the weight of every edge. Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in G before and after the edge weight update?
A
Every MST remains an MST, and every SP remains an SP.
B
MSTs need not remain MSTs, and every SP remains an SP.
C
Every MST remains an MST, and SPs need not remain SPs.
D
MSTs need not remain MSTs, and SPs need not remain SPs.

Correct : c

The correct answer is Option C - Every MST remains an MST, but shortest paths need not remain shortest paths.
MST - stays the same:
MST algorithms like Kruskal's and Prim's work on relative edge weights. Adding a constant a to every edge shifts all weights equally, so the ordering of edges doesn't change. The same edges get picked — MST is preserved.
Shortest Path — can change:
A path with k edges gets its total cost increased by k × a. So paths with fewer hops get a smaller penalty than paths with more hops. This imbalance can flip which path is shortest.
Quick example — A→B = 1, B→C = 1, A→C = 3. Shortest path A to C is via B (cost 2). Add a = 3 to all edges: A→B = 4, B→C = 4, A→C = 6. Now A→B→C costs 8, but direct A→C costs 6. The shortest path changed.
MST survives uniform weight addition. Shortest paths don't always.

Similar Questions

Let G(V,E) be an undirected and unweighted graph with 100 vertices. Let d(u,v) denote the number of edges in a shortest path between vertices u and v in V. Let...
#1386 MCQ
Consider the following algorithm someAlgo that takes an undirected graph G as input. The output of someAlgo (T) for the tree shown in the given figure is _____...
#1466 NAT
Let G(V, E) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of...
#1527 MCQ

Related Topics

GATE 2025 GATE CS Set 2 GATE Question 37 Graph Theory Minimum Spanning Tree Shortest Path Edge Weight Update Kruskal Algorithm Prim Algorithm Dijkstra Algorithm Adding Constant Edge Weight MST Invariance Shortest Path Change Graph Algorithms

Unique Visitor Count

Total Unique Visitors

Loading......