Question: Problem 1 Consider the directed graph given by V={0, 1, 2, 3, 4, 5), E={[0,2], [0,3], [0,4], [2,1], [2,4], [3,5], [4,0]}. Use the depth-first cycle

Problem 1 Consider the directed graph given by V={0, 1, 2, 3, 4, 5), E={[0,2], [0,3], [0,4], [2,1], [2,4], [3,5], [4,0]}. Use the depth-first cycle detection recursion shown below to determine the color of all vertices when the recursion stops for each of the source vertices 2, 3, 4, and 5. Assume that all vertex colors are reset to WHITE before any run. To simplify the writing, let G=GRAY, B=BLACK, and W=WHITE. Process lowest numbered vertex first in case of a tie. Instead of producing lots of arrays that indicate when the color is changed for which vertex, draw trees that represent the traversal process. Mark and extract the corresponding vertex coloring as shown for source vertices 0 and 1. bool graph::dfs_cycle(int i) { vcolor[i] = GRAY; source=0 Sourc =1 G for (int k=0; k
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
