GATE CS 2025 Set 2 | Question 37

Algorithms › Graph Algorithms · MCQ · 2 marks · Answer: C

  1. Question 37Algorithmsmcq2 marks
    Let be an edge-weighted undirected graph with positive weights. A positive constant is added to every edge weight. Which ONE is TRUE about MSTs and shortest paths (SPs) before and after?
    • 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.

    Answer: C

    Solution

    Answer: (C) Every MST remains an MST, and SPs need not remain SPs. Every spanning tree has exactly edges, so adding increases every spanning tree's weight by the same . The relative ordering is unchanged, so an MST stays an MST. Shortest paths can change: a path with more edges gains more total weight ( for edges), so a formerly-longer path with fewer edges may become shorter. Hence SPs need not be preserved.

More GATE PYQ on Graph Algorithms

All GATE CS Algorithms PYQ →

Attempt GATE CS 2025 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →