Exercise 6 (for week of Mar 29- Apr3)
(A) Show that a digraph has no directed cycles iff there is a topological order
(see page 325 of the text for adefinition). Find an O(n+m) algorithm to find
a topological order if one exists, and NULL otherwise.
(B) Review the algorithm to detect whether a digraph is strongly connected.
Notice that if it is not, there must be at least two vertices a,b that are
in differnet components, namely, either a does not reach b or vice versa.