Question

(A) Consider the following algorithm for computing a topological sort of a DAG G: add the...

(A) Consider the following algorithm for computing a topological sort of a DAG G: add the vertices to an initially empty list in non-decreasing order of their indegrees. Either argue that the algorithm correctly computes a topological sort of G, or provide an example on which the algorithm fails.

(B) Can the number of strongly connected components of a graph decrease if a new edge is added? Why or why not? Can it increase? Why or why not?

(C) What is the minimum number of strongly connected components that a directed acyclic graph (DAG) on n nodes can have? What is the maximum number? Justify your answers.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A. No above process will not always work to give topological sorting. Consider the directed chain graph shown below :-

As evident from the figure, only one topological order exist in above graph is A,B,C,D,E where source vertex comes before target vertex.

But as per the proposed algorithm, vertex A have minimum in-degree of zero, so it will first selected vertex A. But now every remaining vertex have in-degree 1 and hence algorithm can pick any one of them which is wrong. Hence algorithm fail in this case.

B. Adding a new edge into a graph enhances the connectivity of a graph. So adding a new edge can either join two disconnected component in which number of connected component will reduce by one or it will remain same when newly added edge connects two vertices in same connected component. But number of connected component will never increase by adding a new edge.

C. A set of vertices in a directed graph is said to be part of strongly connected component if there is directed path between every pair of vertices.  

Since there does not exist any cycle in DAG, this means if there is directed path from vertex A to B, then there cannot be directed path from B to A, otherwise they will form cycle. Hence in a DAG, there does not exist any pair of vertices which are in same strongly connected component. In other words, every single vertices is only part of its own connected component. Hence minimum strongly connected component in DAG in n, where n is number of vertices.

The maximum number of connected component will also be n since number of strongly connected component cannot exceeds number of vertices.

Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
(A) Consider the following algorithm for computing a topological sort of a DAG G: add the...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT