Say I have a graph with nodes representing cities and and relations representing possible connections between cities. A connection has a departure and an arrival time. I want to find the shortest path between cities A
and B
and the cost function is the total travel time. The travel time is the sum of waiting times between connections and connection times.
I'm using the Java API and I have tried using the Dijkstra algorithm using GraphAlgoFactory.dijkstra(expander, costEvaluator)
. My main problem seems to be, that the CostEvaluator
interface only receives the current relation and not the complete path. This way I can compute the connection duration but not the waiting time.
Is there something I can do to adapt the existing algorithm or do I have to reimplement Dijkstra?