Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Give an efficient algorithm which takes as input a directed graph G(V,E)and determines whether or not there is a vertexsV from which all other vertices are reachable.

Short Answer

Expert verified

Algorithm takes as input a directed graph G(V,E) and determines whether or not there is a vertexsVfrom which all other vertices are reachable is proved.

Step by step solution

01

Explain the algorithm for determining a vertex s∈V from which all the vertices are reachable.

A vertex s belongs to G(V,E) where v is the vertex and e is the edges such that all other vertices are reachable from the vertex s and this vertex s is known as mother vertex. And there may be more than one mother vertex present in the graph.

In other words, it states that all other vertices in G are reached by a path from v. Kosaraju's algorithm is used to find strongly connected component in the graph.

02

Determine the mother vertex.

In an undirected graph, here all vertices are act as a mother vertex because from each vertex makes their path towards its every other vertex.

Or to finding the mother vertex in any directed graph here, check all vertices of the given graph and detect from which vertex every other node are connected.

Let a directed graph which contain nine edges and seven vertices. In this graph node 5 is act as a mother vertex from which all other vertices are reachable. For example, the graph is given below:

5is the mother vertex in directed graph.

Here in this graph from vertex five all other vertices are reachable. From 52by one vertex in the middle that is 2. From54by follow the directions from 564.

From 53by following the path that is56413there is the direct path from 52and at the last from 51path is 5601.

03

 A directed graph with mother vertices.

Another example is given as the directed graph which contain five edges and five vertices 0,1,2,3,4,5. In this graph node 0, 1 and 2 are act as a mother vertex from which all other vertices are reachable.

From vertices 0,1,2, all other vertices are reachable. From 0 to 1, consider 2 as a middle vertex. Like that from zero all the other vertices are visited. Then from 1 to 3, consider 0 as a middle vertex. Like that from 0, all the other vertices are reachable same as by the mother node 2.

Hence,thealgorithm that determines whether or not there is a vertexsVfrom which all other vertices are reachable is proved.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Either prove or give a counterexample: if {u,v}is an edge in an undirected graph, and during depth-first search (u)<post (v), then vis an ancestor of uin the DFS tree.

The reverse of a directed graph G = (V,E) is another directed graphGR=(V,ER) on the same vertex set, but with all edges reversed that is,ER={(v,u):(u,v)E} . Give a linear-time algorithm for computing the reverse of a graph in adjacency list format.

Question:Undirected vs. directed connectivity.

(a) Prove that in any connected undirected graph G =(V , E)there is a vertexvV whose removal leaves G connected. (Hint: Consider the DFS search tree for G.)

(b) Give an example of a strongly connected directed graph G(V ,E)such that, for everyvV, removing v from G leaves a directed graph that is not strongly connected.

(c) In an undirected graph with two connected components it is always possible to make the graph connected by adding only one edge. Give an example of a directed graph with two strongly connected components 0 such that no addition of one edge can make the graph strongly connected.

On page 102, we defined the binary relation “connected” on the set of vertices of a directedgraph. Show that this is an equivalence relation(see Exercise 3.29), and conclude that it partitions the vertices into disjoint strongly connected components.

The police department in the city of Computopia has made all streets one-way. The mayor contends that there is still a way to drive legally from any intersection in the city to any other intersection, but the opposition is not convinced. A computer program is needed to determine whether the mayor is right. However, the city elections are coming up soon, and there is just enough time to run a linear-time algorithm.

a) Formulate this problem graph-theoretically, and explain why it can indeed be solved in linear time.

(b) Suppose it now turns out that the mayor’s original claim is false. She next claims something weaker: if you start driving from town hall, navigating one-way streets, then no matter where you reach, there is always a way to drive legally back to the town hall. Formulate this weaker property as a graph-theoretic problem, and carefully show how it too can be checked in linear time.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free