# I built the T with Python (and revamped it)

Below, see what those transfer edges looked like in the text file.place-pktrm_red,place-pktrm_green,5,blackplace-gover_blue,place-gover_green,5,blackplace-state_orange,place-state_blue,5,blackplace-haecl_green,place-haecl_orange,5,blackplace-north_green,place-north_orange,5,blackplace-dwnxg_red,place-dwnxg_orange,5,blackplace-kencl_B,place-kencl_C,5,blackplace-kencl_C,place-kencl_D,5,blackplace-kencl_D,place-kencl_B,5,blackplace-coecl_BCD,place-coecl_E,1,blackplace-jfk_A,place-jfk_B,5,blackMy algorithm calculates average passenger trip time like this:Iterates over each edge on the demand network (e.g. Station A to Station B, 150 passengers/day)Calculates shortest path/travel time between those stations (e.g. Station A to Station B has a shortest path that takes 13 minutes)Multiplies the number of passengers by the length of travel (e.g. Station A to Station B contributes 1950 “passenger-minutes” per day)Sums up the passenger-minutes for each connection, and then divides by the total number of passengersHere’s how I did it!Using this algorithm, I found that the average trip time on the T (on a weekday) is 14.7 minutes.So, what if the MBTA finally built that Red Line-Blue Line connector?Here’s what the network would look like with the Red and Blue Lines connected at Charles/MGH!.(Currently, the Blue Line ends at Bowdoin.)There has been talk for years about extending the Blue Line from Bowdoin — where it ends — to Charles/MGH..The Red and Blue Lines are the only two main lines of the network (sorry, Silver Line) that are not directly connected — currently, you’d have to take either the Orange or Green Lines to get between the two lines without leaving the subway..Since the two lines get pretty close geographically (as in, a 5-minute walk), it can feel pretty silly to take the Orange or Green line one stop just to avoid tapping your Charlie Card again and paying another \$2.25.What would be the benefit of a Red Line-Blue Line connection?.My model predicted that the Red Line-Blue Line connection might not be very useful, after all..The average passenger trip time was 14.70 minutes without the connection; with the connection, the average passenger trip time became 14.66 minutes..On average, this connection will make a negligible difference to passengers (particularly compared to the inconvenience of the construction period)..However, the connection would not make any difference to passengers unless they actually travel between the Red and Blue Lines..So, I also looked at that difference..I made another version of average_shortest_path that only looks at the passengers traveling between two distinct groups of stations — in this case, Red Line stations and Blue Line stations.Without the connection, passengers that travel between the two lines have an average trip time of 16.61 minutes..With the connection, this goes down to 15.77 minutes, so it saves almost one minute per day for these passengers..This is a more significant difference.. More details