Question: You are given a directed acyclic graph G = (V, E) with unweighted edges. Every vertex v V has an integer score s[v]. For
You are given a directed acyclic graph G = (V, E) with unweighted edges. Every vertex v V has an integer score s[v]. For a vertex v, we say that a vertex u is an ideal target for v if: 1. It is possible to go from v to u. 2. s[u] is maximized. In other words, out of all vertices that u can reach, u (i.e. v's ideal target) is the one with the maximum score. Given the scores for all vertices, describe a linear-time algorithm to find the ideal targets for every vertex v. (Note that v can be its own ideal target.) Just provide the algorithm description and runtime analysis. Proof of correctness and space complexity analysis are not required.
Step by Step Solution
3.31 Rating (154 Votes )
There are 3 Steps involved in it
find the ideal targets for every vertex in a directed acyclic graph with unweighted edges where each ... View full answer
Get step-by-step solutions from verified subject matter experts
