Graph Algorithms

Answer & solution
Official answer: 929
Step through it (10 steps)
Process vertices topologically with Q(v)=max over predecessors u of Q(u)*weight(u, v), starting Q(s)=1. The diagram yields Q(a)=9, Q(c)=1, Q(b)=9, Q(d)=max(1, 9)=9, Q(f)=9, Q(e)=max(9, 81)=81, Q(g)=max(9, 81)=81, Q(t)=max(81, 729)=729. Sum=1+9+1+9+9+9+81+81+729=929.
A topological dynamic program initializes score(s)=1 and all other scores=0, then for each edge u→v sets score(v)=max(score(v),score(u)×weight). A predecessor ordering such as s,a,b,c,d,e,f,g,t suffices. It runs in O(V+E), since a DAG has no profitable cycle to revisit. Store parent pointers when maximizing if an actual maximizing path is also wanted.