V
V
Visphord2015-04-07 17:45:14
Algorithms
Visphord, 2015-04-07 17:45:14

How to build the optimal path for rail travel?

Good afternoon.
I'm trying to develop a rail travel planner.
There is a graph of trains, the vertices of which are the stations, and the edges, respectively, are the trains. Several edges can connect one pair of vertices -> several trains can go from one station to another.
Also in the properties of the edges there is a time "on the way", the time of arrival and the time of departure.
It is necessary to find the optimal path from vertex A to vertex B, taking into account the transfer time (and, accordingly, waiting for the train).
Tell me, please, in which direction to dig?
I tried to apply Dijkstra's algorithm - but I could not figure out the transfers (there is always a search for the minimum travel time, according to the algorithm it is very "profitable" to change trains, which is not at all beneficial to a real person).
Those. it turns out that you have to "expand" the conditions of the problem: you need to search not only by one criterion - travel time, but also by the number of transfers, and Dijkstra's algorithm "does not know how" to search by two criteria.
In addition, I would very much like to be able to look for several alternative paths.
Maybe there is some other "solution" or algorithms? I think I'm not the first to face such a task, I would like to know in which direction to dig.
Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
uvelichitel, 2015-04-07
@uvelichitel

I would do so

  • Trivial breadth first search find all paths from Departure to Destination
  • Request ideal route criteria Time, Price, Transfers, Points of Interest...
  • Using cumulative sorting, select from the found paths several Hamming closest to the ideal one according to the specified criteria

X
xmoonlight, 2015-04-07
@xmoonlight

Shortest path (graphs)
About "profitability" - place the weights correctly!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question