GATE / CS ARCHIVE

GATE CSE 2025 SET 1 / QUESTION 18

Comparing tree and graph shortest paths

Algorithms · Graph Algorithms · Full GATE CSE 2025 Set 1 paper

GATE 2025 Set 1, Q18 1 mark · MCQ
Report issue

Graph Algorithms

Question 18, GATE 2025: G is an undirected graph with positive edge weights and T is a minimum spanning tree. Let d1(u,v) be the shortest-path distance in G and d2(u,v) that in T. Which holds for all vertices and all such graphs? A d1=d2; B d1≤d2; C d1≥d2; D d1≠d2.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Compare the sets of paths available in the graph and its spanning-tree subgraph.
The unique u-to-v path in T uses only edges of G. Thus it is one candidate among the paths minimized over when defining d1. Minimizing over a set containing that candidate cannot give a larger value than its length: d1(u,v)≤d2(u,v). Therefore B always holds.
Equality is possible, for example if G itself is a tree. Strict inequality is also possible: take a triangle with all edge weights 1 and a spanning tree consisting of two edges. Between the endpoints of the omitted edge, the graph distance is 1 but the tree distance is 2. These examples reject A and D as universal claims and reject C.
An MST minimizes total chosen-edge weight, not every pairwise path distance. Indeed the inequality holds for any spanning tree; minimum total weight is unnecessary for this particular proof.

Original paper, page 18 · Answer key