Question

Let G be a directed graph. In class, we saw an algorithm that uses the information...

Let G be a directed graph. In class, we saw an algorithm that uses the information obtained from a DFS to determine the strongly connected components of G. Make an argument for why using instead BFS will not work. Namely, focus on why the order in which we visit vertices in a BFS does not give us any information about the strongly connected component structure in G (note a BFS does not label vertices with pre and post values, so in your argument, just work with the order in which vertices are dequeued from the BFS queue).

Homework Answers

Answer #1

Strongly Connected Components

A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph is a maximal strongly connected subgraph.

We can find all strongly connected components in O(V+E) time using Kosaraju’s algorithm.

Following is detailed Kosaraju’s algorithm(DFS based).

  • Create an empty stack ‘S’ and do DFS traversal of a graph. In DFS traversal, after calling recursive DFS for adjacent vertices of a vertex, push the vertex to stack.
  • Reverse directions of all arcs to obtain the transpose graph.
  • One by one pop a vertex from S while S is not empty. Let the popped vertex be ‘v’. Take v as source and do DFS(v). The DFS starting from v prints strongly connected component of v.

How does this work?

The above algorithm is DFS based. It does DFS two times. DFS of a graph produces a single tree if all vertices are reachable from the DFS starting point. Otherwise DFS produces a forest. So DFS of a graph with only one SCC always produces a tree. The important point to note is DFS may produce a tree or a forest when there are more than one SCCs depending upon the chosen starting point.

In the next step, we reverse the graph. In the reversed graph, the edges that connect two components are reversed. So if we do a DFS of the reversed graph using sequence of vertices in stack, we process vertices from sink to source (in reversed graph). That is what we wanted to achieve and that is all needed to print SCCs one by one.

Kosaraju’s BFS based simple algorithm also work on the same principle as DFS based algorithm does.

We can also use BFS based Kosaraju's algorithm for getting the Strongly connectd components.

We don't need the order in which it visits the vertices. We just want to know how many vertices and what are all those vertices we can reach by starting traversal from this location. This can be achieved by DFS or BFS as both are graph traversal algorithms and both can do this task.

Following is Kosaraju’s BFS based simple algorithm that does two BFS traversals of graph:

  • Initialize all vertices as not visited.
  • Do a BFS traversal of graph starting from any arbitrary vertex v. If BFS traversal doesn’t visit all vertices, then return false.
  • Reverse all edges (or find transpose or reverse of graph) Mark all vertices as not visited in reversed graph.
  • Again do a BFS traversal of reversed graph starting from same vertex v (Same as step 2). If BFS traversal doesn’t visit all vertices, then return false. Otherwise, return true.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
As you saw from the lab PowerPoint slides last week, you will be doing a research...
As you saw from the lab PowerPoint slides last week, you will be doing a research study looking at ‘Aggression Priming” for your first paper. For this week’s discussion, I want you to discuss with your group what you think this study is about. What is the hypothesis? What theory does it come from? What do you predict will happen (do you expect something different than the hypothesis in the researcher instructions? If so, what and why?)? Do you think...
The Business Case for Agility “The battle is not always to the strongest, nor the race...
The Business Case for Agility “The battle is not always to the strongest, nor the race to the swiftest, but that’s the way to bet ’em!”  —C. Morgan Cofer In This Chapter This chapter discusses the business case for Agility, presenting six benefits for teams and the enterprise. It also describes a financial model that shows why incremental development works. Takeaways Agility is not just about the team. There are product-management, project-management, and technical issues beyond the team’s control. Lean-Agile provides...
INTELLECTUAL PROPERTY  Industrial property forms part of the broader concept of "intellectual property."  The...
INTELLECTUAL PROPERTY  Industrial property forms part of the broader concept of "intellectual property."  The objects of intellectual property are the creations of the human mind, the human intellect hence the expression "intellectual" property.  In a somewhat simplified way, one can state that intellectual property relates to pieces of information which can be incorporated in tangible objects at the same time in an unlimited number of copies at different locations anywhere in the world.  The property is...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old man of Scandinavian descent was rushed to the Emergency Room of your local hospital after a family member discovered him unconscious in his home. The woman who dialed “911” told the dispatcher that the man, her brother, was the local librarian of the past 10 years and had no spouse or children. She reported that they had spoken the day before, and he had...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect on what happens to the families when there is a suicide in the family, based on the Seasons of Love chapter...how should people be told? What details are best left unshared? below is the story These theories may have a certain face-validity, but they often neglect environmental or contextual factors that are innate to answering the question of “why” a person might engage in...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...