Question
In a directed acyclic graph with a source vertex , the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a vertex other than , the quality-score of is defined to be the maximum among the quality-scores of all the paths from to . The quality-score of is assumed to be 1.
The sum of the quality-scores of all the vertices in the graph shown above is ______.
Official answer and solution
- Official answer
- 929
- From
- Official GATE 2021 answer key
Solution
Compute the quality-score of each vertex in topological order by maximizing the product of incoming edge weights and predecessor scores.
Let the 9 vertices be arranged in a grid with coordinates:
- Bottom row: (source), ,
- Middle row: , ,
- Top row: , ,
Given that .
Compute quality scores in topological order:
- Vertex has incoming edges from and :
- From :
- From :
- Vertex has incoming edges from and :
- From :
- From :
- Vertex has incoming edges from and :
- From :
- From :
- Vertex has incoming edges from and :
- From :
- From :
Sum the quality-scores across all 9 vertices:
929
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 65 of 65, printed as CS Q.55
- 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.