Question
Consider the weighted undirected graph with 4 vertices, where the weight of edge is given by the entry in the matrix :
The largest possible integer value of , for which at least one shortest path between some pair of vertices will contain the edge with weight is _____.
Official answer and solution
- Official answer
- 12
- From
- Official GATE 2016 answer key
Solution
Find the shortest alternate path between vertices 3 and 4 that avoids edge {3, 4}.
We are given the 4-vertex distance matrix:
The edge with variable weight is .
For edge to be contained in at least one shortest path between some pair of vertices, it must at least be a shortest path between its own endpoints 3 and 4 (or contribute to another shortest path).
Find all alternate paths between vertex 3 and vertex 4 without using edge :
- Path : weight
- Path : weight
- Path : weight
The minimum weight among all alternate paths connecting 3 and 4 is 12.
If , the direct path has weight , which is less than or equal to the alternate path weight 12, making it a valid shortest path between 3 and 4.
If , the path has weight 12, strictly shorter than direct edge , and edge cannot be part of any shortest path between any pair of vertices.
Therefore, the largest integer value of is 12.
12
Checking only 2-edge paths ( and ) giving 13, missing the 3-edge path of length 12.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 1
- Question
- 48 of 65, printed as CS Q.38
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.