4. (15 pts) (Graph algorithm) For graph G with nodes V = {A, B, C, D, E, F, G, H} and adjacency matrix given below, answer the following two questions:
ABCDEFGH
A|0 1 1 0 0 1 0 0
B|0 0 0 1 0 0 0 0
C|1 0 0 0 1 0 0 0
D|1 0 0 0 0 0 0 1
E|1 0 0 0 0 1 1 1
F|0 1 0 0 0 0 1 0
G|0 0 0 0 0 0 0 0
H|1 0 0 0 0 0 0 1
(a) Draw the graph (next to the adjacency matrix), using lines with arrows if the edges are directed.
(b) Is the graph a DAG (Directed Acyclic Graph)? When performing DFS traversal to detect cycle, suppose we pick node A to traverse from first). Draw the recursion trees of the DFS traversal (refer to slides/notes on the pseudocode), comment on when you find out if the graph has cycle (if there is one).
(c) Based upon the above DFS traversal in the previous question, order the nodes in the reversing order of the times they turns black. Is this a topological ordering of the nodes? Why?