Question: Consider the algorithm we discussed in class for finding strongly connected components of a directed graph G = (V,E) by using BFS. Bob wants

Consider the algorithm we discussed in class for finding strongly connected components 

Consider the algorithm we discussed in class for finding strongly connected components of a directed graph G = (V,E) by using BFS. Bob wants to decompose G into its strongly connected components. That is, he wants to find all the strongly connected components of G. He proposes the following algorithm for doing this: 1: Let k = 0 2: for each vertex u V do 3: 4: 5: 6: 7: 8: if u UCk (i.e., v is not contained in any of the components Co, C1,..., Ck) then Run BFS(u) on G to get a BFS tree T Run BFS(u) on GR to get a BFS tree T' Let Ck = {vvETA u E T'} be the set of vertices discovered in both runs of BFS(u) Set kk +1 end if 9: end for 10: return Co, C1,..., Ck are the strongly connected components of G Note that this can be implemented so that checking the condition of the if statement (line 3) takes constant time and so that constructing the set Ck in line 6 takes time (n) (e.g., by keeping track of appropriate boolean variables for each vertex during BFS). What is the worst-case running time (in notation) of Bob's algorithm? Explain your answer (e.g., describe what kind of input causes this running time). How does this compare to the DFS-based approach from class?

Step by Step Solution

3.45 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Bobs algorithm for finding strongly connected components using BFS has a worstcase running time of O... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!