GateAI
Graph Theory

GATE CSE 2021 Set 2 · Q55

NAT2 marksMedium

Time

In a directed acyclic graph with a source vertex s\mathbf{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 vv other than s\mathbf{s}, the quality-score of vv is defined to be the maximum among the quality-scores of all the paths from s\mathbf{s} to vv. The quality-score of s\mathbf{s} is assumed to be 1. The sum of the quality-scores of all the vertices in the graph shown above is ________.

GATE CSE 2021 Set 2 Q55 diagram

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 929

Graph Theory

Let Q(v)Q(v) denote the quality-score of vertex vv. Since the graph is a directed acyclic graph (DAG), we can compute Q(v)Q(v) for each vertex in topological order using the recurrence:

Q(v)=max⁡(u,v)∈E{Q(u)×w(u,v)}Q(v) = \max_{(u, v) \in E} \{ Q(u) \times w(u, v) \}

with the base case Q(s)=1Q(\mathbf{s}) = 1.

Let us compute the quality-score for each of the 9 vertices:

  1. Vertex s\mathbf{s}:

    Q(s)=1Q(\mathbf{s}) = 1
  2. Vertex aa:

    Q(a)=Q(s)×w(s,a)=1×9=9Q(a) = Q(\mathbf{s}) \times w(\mathbf{s}, a) = 1 \times 9 = 9
  3. Vertex bb:

    Q(b)=Q(a)×w(a,b)=9×1=9Q(b) = Q(a) \times w(a, b) = 9 \times 1 = 9
  4. Vertex cc:

    Q(c)=Q(s)×w(s,c)=1×1=1Q(c) = Q(\mathbf{s}) \times w(\mathbf{s}, c) = 1 \times 1 = 1
  5. Vertex dd: Incoming edges are from cc and aa:

    • From cc: Q(c)×w(c,d)=1×1=1Q(c) \times w(c, d) = 1 \times 1 = 1

    • From aa: Q(a)×w(a,d)=9×1=9Q(a) \times w(a, d) = 9 \times 1 = 9

    Q(d)=max⁡(1,9)=9Q(d) = \max(1, 9) = 9
  6. Vertex ee: Incoming edges are from bb and dd:

    • From bb: Q(b)×w(b,e)=9×1=9Q(b) \times w(b, e) = 9 \times 1 = 9

    • From dd: Q(d)×w(d,e)=9×9=81Q(d) \times w(d, e) = 9 \times 9 = 81

    Q(e)=max⁡(9,81)=81Q(e) = \max(9, 81) = 81
  7. Vertex ff:

    Q(f)=Q(c)×w(c,f)=1×9=9Q(f) = Q(c) \times w(c, f) = 1 \times 9 = 9
  8. Vertex gg: Incoming edges are from ff and dd:

    • From ff: Q(f)×w(f,g)=9×1=9Q(f) \times w(f, g) = 9 \times 1 = 9

    • From dd: Q(d)×w(d,g)=9×9=81Q(d) \times w(d, g) = 9 \times 9 = 81

    Q(g)=max⁡(9,81)=81Q(g) = \max(9, 81) = 81
  9. Vertex tt: Incoming edges are from gg and ee:

    • From gg: Q(g)×w(g,t)=81×1=81Q(g) \times w(g, t) = 81 \times 1 = 81

    • From ee: Q(e)×w(e,t)=81×9=729Q(e) \times w(e, t) = 81 \times 9 = 729

    Q(t)=max⁡(81,729)=729Q(t) = \max(81, 729) = 729

Sum of the quality-scores of all vertices:Sum=Q(s)+Q(a)+Q(b)+Q(c)+Q(d)+Q(e)+Q(f)+Q(g)+Q(t)=1+9+9+1+9+81+9+81+729=929\begin{aligned} \text{Sum} &= Q(\mathbf{s}) + Q(a) + Q(b) + Q(c) + Q(d) + Q(e) + Q(f) + Q(g) + Q(t) \\ &= 1 + 9 + 9 + 1 + 9 + 81 + 9 + 81 + 729 \\ &= 929 \end{aligned}

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Graph Theory previous year question is Q55 of the GATE CSE 2021 Set 2 paper. Find more GATE CSE PYQs on Graph Theory in Engineering Mathematics, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Graph Theory PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Graph Theory in GATE CSE

Graph Theory has 21 GATE CSE PYQs across 14 papers from 2012 to 2026. 7 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2021 Set 2.

How GATE tests Graph Theory

More from GATE CSE 2021 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2021 Set 2 · Q55 · NAT

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 v other than s, the quality-score of v is defined to be the maximum among the quality-scores of all the paths from s to v. 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 …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.