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
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 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 s
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 15 0 0 12 Sample output 9 4 1/2 9/10 1 5 6 11/12 5/6 3/8 3 4/7] 1 2 3 4 5 6 () (1,3) (5) () () (2) Act Go t