Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A digraph is called strongly connected, if between any two vertices there is a ( directed ) path. The simplest example for strongly connected digraphs

A digraph is called "strongly connected", if between any two vertices there is a (directed) path. The simplest example for strongly connected digraphs is the (directed) cycle graph, that is, for n >=1 we have the vertices 1,...,n, and the arcs (1,2),(2,3),...,(n-1,n),(n,1).
Now the task is to decide whether an input digraph G is strongly connected. Which of the following algorithms does the job (using n >=1 for the number of vertices of G)?
For wrong ticks negative marks are given.
A digraph is called "strongly connected", if between any two vertices there is a (directed) path. The simplest example for strongly connected digraphs is the (directed) cycle graph, that is, for n >=1 we have the vertices 1,...,n, and the arcs (1,2),(2,3),...,(n-1,n),(n,1).
Now the task is to decide whether an input digraph G is strongly connected. Which of the following algorithms does the job (using n >=1 for the number of vertices of G)?
For wrong ticks negative marks are given.
Choose a start vertex s.
Run BFS with start vertex s. If one of the distances is infinity, then G is not strongly connected, and the algorithm terminates.
Now obtain the new digraph G' by keeping the vertices, while reversing the direction of the arcs.
Run BFS with start vertex s on G'. The original G now is strongly connected iff in G' none of the distances is infinity.
Run DFS, without controlling the vertex order. If a restart was needed, then G is not strongly connected, and the algorithm terminates.
Obtain the new digraph G' from G by keeping the vertices, while reversing the direction of the arcs. Run DFS on G', again without controlling the vertex order. Now G is strongly connected, iff this run of DFS didn't need a restart.
Run BFS, without controlling the vertex order. If from the start vertex (which depends on the vertex order) we can not reach every other vertex, then G is not strongly connected.
Otherwise obtain the new digraph G' from G by keeping the vertices, while reversing the direction of the arcs. Run BFS on G', again without controlling the vertex order. If from the start vertex (which depends on the vertex order) we can not reach every other vertex, then G is not strongly connected, while otherwise G is strongly connected.
Pick any vertex s.
Run DFS with start vertex s. If finishing time of s is not 2n, then G is not strongly connected, and the algorithm terminates.
Now obtain the new digraph G' by keeping the vertices, while reversing the direction of the arcs.
Run DFS with start vertex s on G'. The original G now is strongly connected iff the finishing time of s is (again)2n.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. Describe the main retirement benefits.

Answered: 1 week ago