Skip to content
Official PYQ · 2016

GATE CS 2016 Set 1 Q38 — Graphs

Explain with AI
Consider the weighted undirected graph with 44 vertices, where the weight of edge {i,j}\{i,j\} is given by the entry WijW_{ij} in the matrix WW.

 W=[02852058850x58x0]\begin{bmatrix} 0&2 &8 &5 \\ 2&0 &5 &8 \\ 8&5 &0 &x \\ 5& 8 &x &0 \end{bmatrix}

The largest possible integer value of xx, for which at least one shortest path between some pair of vertices will contain the edge with weight xx is ___________.
View worked solution

Answer: 12

Let the vertices of the graph be 1,2,3,1, 2, 3, and 44. The edge with weight xx is between vertices 33 and 44, represented as e={3,4}e = \{3, 4\}.

For the edge {3,4}\{3, 4\} to be part of at least one shortest path between some pair of vertices, the direct edge {3,4}\{3, 4\} must be a shortest path between 33 and 44. This requires that the weight xx must be less than or equal to the length of the shortest alternative path between 33 and 44 that does not use the edge {3,4}\{3, 4\}:

x≤distG∖{{3,4}}(3,4)x \le \text{dist}_{G \setminus \{\{3, 4\}\}}(3, 4)

Let's find all alternative paths between 33 and 44 and their respective weights:

  • Path 3→1→43 \to 1 \to 4: weight =W31+W14=8+5=13= W_{31} + W_{14} = 8 + 5 = 13
  • Path 3→2→43 \to 2 \to 4: weight =W32+W24=5+8=13= W_{32} + W_{24} = 5 + 8 = 13
  • Path 3→2→1→43 \to 2 \to 1 \to 4: weight =W32+W21+W14=5+2+5=12= W_{32} + W_{21} + W_{14} = 5 + 2 + 5 = 12

The shortest alternative path has a weight of 1212. Therefore, we must have x≤12x \le 12.

Thus, the largest possible integer value of xx is 12.

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

Published
Report a correction
Keep exploringMore Graphs questions