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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 38 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply