Public transport travel planner
Project summary
Like most public transport systems around the world, the Stockholm public transport system (Stockholms Lokaltrafik, SL) has a travel planner service. This service lets the user pick where to go, from where and when to do this. It also provides an array of filters for preferences. This project aimed to recreate a scaled-down version of that system using GTFS (General Transit Feed Specification) data from a single day.
Demo (in Swedish). The user is asked to enter departure station, arrival station, if they'd be willing to walk and how far, and finally if they want to look for direct routes. The route is presented, along with some extra search info.
Development
This was one of two larger projects I made for a university class on data structures and algorithms (find the other one here). The task consisted of representing the Stockholm public transport system as a graph and then implementing a fitting search algorithm for said graph. This was to be done without sacrificing any expected features of a travel planner such as considering the time of day, the ability to walk between stations, and preferring direct routes, etc.
​
My contribution
This project is a console-based application focusing primarily on the intricacies of script development, for which I was solely responsible. The main objectives were:
​
-
Modifying the A* pathfinding algorithm to enable node traversal without a connecting edge, facilitating walking scenarios.
-
Adapting the A* algorithm to consider potentially slower but more direct paths.
-
Introducing a dynamic edge cost function influenced by time of day and departure schedules.
​
A significant challenge was incorporating dynamic (non-static) edge costs into a multigraph environment, which allows multiple routes between any two nodes. I addressed this by archiving all arrival and departure times for each station in a hashtable, sorted by time. This time-based sorting expedited binary searches, optimizing the determination of edge costs during the A* algorithm execution.
​
Further enhancements could have included additional filters (e.g., bypassing bus routes) and the integration of a graphical user interface and multilingual support. However, time constraints limited these expansions.
The dynamic edge cost function to account for time of day in the GTFSGraph