Page 1 of 1

The directed graph is given with the adjacency list. The vertex of directed graph is called a source if no edge comes in

Posted: Sat Jul 09, 2022 11:48 am
by answerhappygod
The Directed Graph Is Given With The Adjacency List The Vertex Of Directed Graph Is Called A Source If No Edge Comes In 1
The Directed Graph Is Given With The Adjacency List The Vertex Of Directed Graph Is Called A Source If No Edge Comes In 1 (112.37 KiB) Viewed 39 times
Write the code in java or c++ language it is urgent do itasap
The directed graph is given with the adjacency list. The vertex of directed graph is called a source if no edge comes into it. Count the number of sources in the graph. Input 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 number of sources in the graph. Sample input 5 1 3 2 1 3 15 2 12 21 2 Sample output 1 5 1 4 3 1 2 3 4 5 (3) (1,3) (5) (1,2) (1,2) Activate Windows Go to Settings to activate Window