Question: (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

(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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

A The algorithm you provided for computing a topological sort of a DAG G correctly computes a topological sort of G To prove this we can use the following inductive argument Base case If G has no vert... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!