-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathride_builder.py
More file actions
32 lines (20 loc) · 787 Bytes
/
ride_builder.py
File metadata and controls
32 lines (20 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from Subway import *
from Subway.Utils import DistanceType
import json
def main():
def station_filter(station):
return station.get_division() == "IRT"
# Load the data from disk
system = SubwayLinkSystem("data", station_filter)
system.calc_distances(DistanceType.Segments)
with open("data/longest_path.json") as f:
station_ids = json.load(f)
stations = [system.get_station(station_id) for station_id in station_ids]
for station in stations:
print("%s %s: %s" % (station.get_id(), station.get_borough(), station))
# ride = SubwayRide.build_ride_from_links(stations, DistanceType.Segments)
# print("----------------")
# print(ride.get_ride_summary())
# print(ride.print())
if __name__ == "__main__":
main()