Question: Given a directed acyclic graph (DAG) G=(V,E) with n=V and m=E, a path in G is said to be tail-maximal if it ends at a

Given a directed acyclic graph (DAG) G=(V,E) with n=V and m=E, a path in G is said to be tail-maximal if it ends at a vertex with outdegree zero. (If u is a vertex of outdegree zero then the path consisting of just u itself is a tail-maximal path.) Describe an algorithm with running time O(n+m) that, given a DAG G=(V,E), computes for each vertex u the number of distinct tail-maximal paths that originate at u. (Your algorithm can compute an array P such that P[u] contains the desired number of paths for vertex u.) Prove that your algorithm is correct and that it has the desired running time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
