The answer is D Why Traversing a directed acyclic graph DAG

The answer is D. Why?

Traversing a directed acyclic graph (DAG) G of order 6 with the set of nodes V = {0, 1, 2, 3, 4, 5, 6} resulted in the following trace of the DFS stack S: Which one of the sequences of nodes below is a topological order of G? 2, 5, 3, 6, 4, 1, 0 1, 0, 4, 6, 3, 5, 2 0, 3, 1, 4, 6, 5, 2 5, 2, 0, 3, 1, 4, 6 3, 2, 5, 0, 1, 4, 6

Solution

The principle of the (DFS)algorithm is quite simple: to go forward (in depth) while there is such possibility, otherwise to backtrack.

0->1->4->6,0->3,5->2

Topological sorting:Smallest path first.

5,2,0,3,1,4,6

others option does not give any valid sorting.

The answer is D. Why? Traversing a directed acyclic graph (DAG) G of order 6 with the set of nodes V = {0, 1, 2, 3, 4, 5, 6} resulted in the following trace of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site