Page 1 of 1

Directed unweighted graph is given with the list of edges. Let dist[u] contains the shortest path from vertex v = 5 to t

Posted: Sat Jul 09, 2022 11:48 am
by answerhappygod
Directed Unweighted Graph Is Given With The List Of Edges Let Dist U Contains The Shortest Path From Vertex V 5 To T 1
Directed Unweighted Graph Is Given With The List Of Edges Let Dist U Contains The Shortest Path From Vertex V 5 To T 1 (49.91 KiB) Viewed 56 times
Write code in java or C++
Directed unweighted graph is given with the list of edges. Let dist contains the shortest path from vertex v = 5 to the vertex u. If there is no path from v = 5 to u, set dist = -1. Find the sum of the values dist[1] + dist[2] + ... + dist[n] (graph contains n vertices, numbered from 1 to n). Input The first line contains the number of vertices. Each next line contains an edge. Output Print the sum of the values dist[1] + dist[2] + ... + dist[n], whre n is the number of vertices. Sample input 6 53 32 Sample output 5 6 start Activate Windows