Question: Subject- Algortihms , Techinques and Theory please provide an appropirate algortihm and there is no hurry so please help 2. (15 points) For any digraph

2. (15 points) For any digraph G=(V,E), we define the following two predicates. P(G) : for every pair (u,v) in VV, there is a directed path from u to v and there is a directed path from v to u. Q(G) : for every pair (u,v) in VV, there is a directed path from u to v or there is a directed path from v to u. Thus P(G) holds if and only if G is strongly connected. Design and analyze an O(E+ V)-time algorithm that takes as input a digraph G=(V,E) and determines whether Q(G) holds. Hint: Start by computing the strongly connected components of G. Use the output of this computation to define a suitable auxiliary DAG G. Compute a topological ordering of G, and use this ordering to determine whether Q(G) holds
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
