GATE CSE 2021 Set 2 Q65: Sum of maximum-product path scores in a weighted DAG
- Algorithms
- 2 marks
- NAT
- No negative marking
Question
In a directed acyclic graph with a source vertex s, 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 s, the quality-score of is defined to be the maximum among the quality-scores of all the paths from s to . The quality-score of s is assumed to be 1.
The sum of the quality-scores of all the vertices in the graph shown above is ________.

Try it: numerical answer: type the value
Show answer and explanation
Answer: 929 (official GATE 2021 final answer key)
Concept used: Longest-path style dynamic programming in topological order, with product instead of sum.
First step: Process vertices in topological order: score(v) = max over incoming edges (u, v) of score(u) × w(u, v), starting with s = 1, c = 1, a = 9.
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key
More Algorithms PYQs
- 2026 Session 1 · Q17Solve nested recurrences T1 = 4T1(n/2) + T2, T2 = 5T2(n/4) + log n
- 2026 Session 1 · Q41Shortest paths with at most k edges: two statements
- 2026 Session 1 · Q47Condition forcing a vertex into every minimum vertex cover
- 2026 Session 1 · Q49Cycle and cut properties of MSTs with distinct weights
- 2026 Session 1 · Q50Impossible DFS discovery/finish orderings for a DAG edge
- 2026 Session 1 · Q55Properties of 2-colorable (bipartite) graphs