Alternative Algorithms (k-Detour, KSP)

Hi all!

I am currently working on an app that modifies a route according to user-entered preferences such as extra steps, time or distance. An additional feature would be changing routing to go through waypoints from a Postgres DB. For this, I have considered implementing Yen’s algorithm to brute-force it by generating many possible paths and choosing between them, or a k-Detour approach to directly solve the problem.

Is there a way to extend / define additional routing algorithms for the graphhopper engine based on existing ones?

TIA :smiling_face:

GraphHopper already uses different routing algorithms. Take a look at for example how Dijkstra.java and AStar.java are used and you will see how the algorithm can be selected.

1 Like

Thank you for your quick reply!

In the docs, I saw that one can implement the RoutingAlgorithm interface; in my case I will need to override calcPaths(int, int) to generate multiple options. So that’s what I’ll do, methinks. I wonder whether anyone else is interested.