/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} 22E Give an efficient algorithm whic... [FREE SOLUTION] | 91影视

91影视

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 91影视!

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

Run the strongly connected components algorithm on the following directed graphs G. When doing DFS on GR: whenever there is a choice of vertices to explore, always pick the one that is alphabetically first.

In each case answer the following questions.

(a) In what order are the strongly connected components (SCCs) found?

(b) Which are source SCCs and which are sink SCCs?

(c) Draw the 鈥渕etagraph鈥 (each meta-node is an SCC of G).

(d) What is the minimum number of edges you must add to this graph to make it strongly connected

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鈥檚 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.

Rewrite the explore procedure (Figure 3.3) so that it is non-recursive (that is, explicitly use a stack). The calls to pre visit and post visit should be positioned so that they have the same effect as in the recursive procedure.

On page 102, we defined the binary relation 鈥渃onnected鈥 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.

Perform a depth-first search on the following graph; whenever there鈥檚 a choice of vertices, pick the one that is alphabetically first. Classify each edge as a tree edge or back edge, and give the pre and post number of each vertex.

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.