- 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 1 (66.84 KiB) Viewed 62 times
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 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