I have a database of bus/train/... stops and the arrival/departure times on each date and so on. I'm looking for a way to do a search for the fastest(shortest/cheapest/least transitions) trip between two locations. I would like to have arbitrary locations in the future, using OpenStreetMap data to do walking between stops and from stops to start/end, however for the time being I just want to find path between two stops in the database.
The problem is I can't seem to find much info about this subject, for example this Wikipedia page has a lot of text with absolutely no useful information in it.
What I've found is the GTFS format, used in Google Transit. While my city doesn't provide a public data feed (not even a private one), I already have all the important information that the GTFS contains and making a transformation would be trivial.
There is some GTFS-based software, like like OpenTripPlanner that can also do pedestrian/car/bike routing using OpenStreetMap.
However, the routing code isn't well documented (at least from I've found) and I don't need the whole thing.
All I'm looking for is some good overview of the algorithms I could use, their performance, maybe some pseudocode.
So, the question is, given a list of stops, routes and arrival/departure/travel times, how can I easily find the fastest path from stop A to stop B?
w:Edges->R
,that indicates the time/money/... for each edge. (*) For 'least transitions', your weight is actually 1 for each edge, so you can even optimize this by running a BFS or even bi-directional BFS instead of dijkstra, as I explained in this post [It is explained for social distance, but it is the same algorithm actually].
EDIT
as an edit to the non-static nature of the graph [for timing] you mentioned on comments [for price and number of transitions, what I have mentioned above still applies, since these graphs are static], you can use a distance vector routing algorithm, which actually meant to work for dynamic graphs, and is a distributed variation of Bellman Ford algorithm.
The algorithm idea:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With