Skip to content
Official PYQ · 2017

GATE CS 2017 Set 1 Q26 — Graph Traversals (BFS, DFS)

Explain with AI

Let G=(V,E)G=\left ( V,E \right ) be anyany connected, undirected, edge-weighted graph. The weights of the edges in EE are positive and distinct. Consider the following statements:

  1. Minimum Spanning Tree of GG is always unique.
  2. Shortest path between any two vertices of GG is always unique.

Which of the above statements is/are necessarily true?

Choose one option
View worked solution

Answer: A

Let's analyze each statement individually:

Statement I: Minimum Spanning Tree of GG is always unique.

This statement is TRUE.

A fundamental theorem in graph theory states that if all edge weights in a connected, undirected graph are distinct, then the graph has a unique Minimum Spanning Tree (MST).

Proof sketch: Suppose there are two different MSTs, T1T_1 and T2T_2. Let ee be the minimum-weight edge that belongs to one of the trees but not both (say e∈T1e \in T_1 and e∉T2e \notin T_2). Adding ee to T2T_2 creates a unique cycle. Since all edge weights are distinct, there is a unique maximum-weight edge on this cycle, which must be strictly heavier than ee. Replacing that heavier edge with ee would yield a spanning tree with a strictly smaller weight than T2T_2, which contradicts the assumption that T2T_2 is an MST. Thus, the MST must be unique.

Statement II: Shortest path between any two vertices of GG is always unique.

This statement is FALSE.

Even if all individual edge weights are positive and distinct, the sum of weights along different paths can still be equal. We can easily construct a simple counterexample:

  • Consider a graph with 3 vertices: AA, BB, and CC.
  • Let the edges and their weights be:
    • w(A,B)=3w(A, B) = 3
    • w(B,C)=1w(B, C) = 1
    • w(A,C)=4w(A, C) = 4
  • All edge weights {1,3,4}\{1, 3, 4\} are positive and distinct.
  • Now, consider the shortest path between AA and CC:
    • Path 1: Direct edge A→CA \to C with total weight =4= 4.
    • Path 2: Path A→B→CA \to B \to C with total weight =3+1=4= 3 + 1 = 4.

Since both paths have the same minimum cost of 44, the shortest path between AA and CC is not unique.

Therefore, only Statement I is necessarily true.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Graph Traversals (BFS, DFS) questions