The directed graph is given in the form of an adjacency list. The vertices are numbered from 1 to n. Run a depth-first s
Posted: Sat Jul 09, 2022 11:47 am
The directed graph is given in the form of an adjacency list. The vertices are numbered from 1 to n. Run a depth-first search on the graph. Find the value of timestamp d[v] or f[v] for a specified vertex v. Input The first line contains the number of vertices n. The next i-th line contains the number of edges adjacent to the i-th vertex and the vertex numbers where these edges go. Output Print the value of d[4]. Sample input 0 2 1 3 1 5 0 0 12 Sample output 9 1/2 4 9/10 5 6 11/12 5/6 3/8 3 4/7 1 2 3 4 5 6 A ← ► () (1,3) (5) () () (2) Activate Go to Settin