Question 17
Consider the following condensed version of the “Trains” dataset. There are a total of n stations, with stations being indexed from 0 to n − 1. There are M rows in the table. Each row contains information about a train that connects two stations without any stops in between.
Consider the following condensed version of the “Trains” dataset. There are a total of n stations, with stations being indexed from 0 to n − 1. There are M rows in the table. Each row contains information about a train that connects two stations without any stops in between.
Row r, tells us that train t departs from station i and arrives at station j after covering a distance of d kilometers without stopping at any intermediate station. Therefore, each train t will occupy multiple rows in this table.
This scenario is modeled as a graph and is represented by a matrix A. Each node in the graph corresponds to a station. Assume that the value of n is already given to you. Consider the following pseudocode.
Consider the following condensed version of the “Trains” dataset. There are a total of n stations, with stations being indexed from 0 to n − 1. There are M rows in the table. Each row contains information about a train that connects two stations without any stops in between.
Row r, tells us that train t departs from station i and arrives at station j after covering a distance of d kilometers without stopping at any intermediate station. Therefore, each train t will occupy multiple rows in this table.
This scenario is modeled as a graph and is represented by a matrix A. Each node in the graph corresponds to a station. Assume that the value of n is already given to you. Consider the following pseudocode.
Based on the above data, answer the given subquestions.
If (i, j) is a pair of stations, which of the following statements about the dictionary A[i][j] are true?
Each key corresponds to a train that goes from station i to j without stoppingat any intermediate station.
Each key corresponds to a train that goes from station i to j. It may stop atmultiple stations between i and j.
The value corresponding to key t of the dictionary is the distance betweenstations i and j on t’s route.
The value corresponding to key t of the dictionary is the minimum distancebetween stations i and j on t’s route.