GATE Computer ScienceHardGATE CS (PYQ pattern)

A transformation is applied to a connected undirected graph with positive edge weights, and the result is compared with the original. Which statements are correct? I. Adding the same positive constant to every edge weight never changes the set of minimum spanning trees. II. Adding the same positive constant to every edge weight never changes the set of shortest paths between two vertices. III. Replacing every weight w by w² never changes the set of minimum spanning trees. IV. Replacing every weight w by w² never changes the set of shortest paths between two vertices.

  1. A. I and III only
  2. B. I, II and III only
  3. C. III and IV only
  4. D. I and IV only

Correct answer: A. I and III only

Every spanning tree has exactly n − 1 edges, so adding a constant shifts all tree weights equally (I), and any strictly increasing map keeps Kruskal's edge order (III). Shortest paths do not survive: paths with different numbers of edges are affected unequally by the shift (II) or by squaring (IV), as random testing against brute force confirms.

More Algorithms questions

Exams that ask this topic