PYTHON PROGRAMMING
Our goal in this problem is to determine the “lowest latency routes” starting from your location. The internet in this problem is modeled by a graph, with vertices corresponding to other clients or servers, and edges representing the links between clients/servers. Each edge is not undirected, i.e., the links are unidirectional. At the same time, each link adds a constant latency if you use the link in your routes. Note that if you need to communicate with your own client, then the latency is 0. We represent your location as the vertex 0. Your goal is to determine the total latency it would take if you used the shortest path route from your location to any other client/server in the network.
Input Format
Each test case starts with a line containing three integers V, E, and Q, denoting the number of vertices, edges, and queries, respectively. Note that vertices are identified with integers from 0 to V-1. E lines follow, each containing three integers s_i, d_i, l_i, denoting the source vertex, destination vertex, and latency; these three integers describe the ith edge. Q lines follow, each containing a single vertex q_i, for which you must determine the total latency T_i of the shortest path from vertex 0 to vertex q.
Constraints
2≤V≤100,000
V≤E≤1,000,000
1≤Q≤V
0≤s_i,d_i
Output Format
For each query vertex q_i, you must output a line containing q_i and T_i. If q_i is not reachable, output “None” instead.
Step by stepSolved in 3 steps with 2 images
- Weighted Graph Applications Demonstration Java Data Structures. Figure 29.23 illustrates a weighted graph with 6 vertices and 8 weighted edges. Simply provide: Minimal Spanning Tree as an illustration or a textual list of edges (in our standard vertex order). Single-Source Shortest Path route from vertex 0 to the other 5 (described as one path/route for each). draw the two solutions and attach the illustration or describe them in text (a list of edges for the one and the vertex to vertex path the other). You can therefore attach proper content files with dot txt, png, jpg or jpeg extensions Be sure the final trees or path lists are clearly visible in your solution. You don't need to show the solution development or progress, just the result.arrow_forwardComputer Architecture: 1. Could you draw a k-map (Please show which one is red and green) 2. Sum the products a. Red group b. Green group c. Final Expressionarrow_forwardIf there is a route from each vertex to every other vertex in the graph, it is called a directed graph.arrow_forward
- Write to code describes how to create the links dataset that represents the input graph. In this particular case, the links represent a directed network. The links dataset has only the nodes identification, which means, the from and to variables. The link weights in the transitive closure problem are irrelevant. In other words, it doesn’t matter the cost or the weight of the links, the algorithm searches for the possible paths to connect the nodes within the input graph. If there is a link or a set of links, no matter the weights, that connects node i to node j, that is the matter.arrow_forward5. For the graph below: 7 5 9 20 3. 1 1 1 3 (Route length is the sum of the weights of the edges in the route. When no weight is assigned to an edge the weight is assumed to be 1.) What is the shortest route from 5 to 5 to 2?arrow_forwardI'm not sure we're to start on this problemarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY