Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compute single source shortest paths with OSRM?

I've been playing around with the OSRM routing library recently. It seems to be highly efficient at solving the shortest path problem. However, I didn't see how to compute single source shortest paths with it. More precisely, given a fixed starting point, compute the shortest distances to all locations that can be reached within a given distance limit (e.g., reachable within 30 minutes).

OSRM uses contraction hierarchies internally. From my understanding, this technique is way superior to Dijkstra's algorithm when it comes to computing the distance between two locations in real world data. However, for my problem, Dijkstra's algorithm seems to fit better, doesn't it?

Does OSRM provide an API to compute single source shortest path problems (with a limit on the distance)? Are there other free routing libraries that are better suited for this type of problem? Preferably one with good support for OpenStreetMap data.

like image 676
Philipp Claßen Avatar asked Dec 30 '12 13:12

Philipp Claßen


People also ask

How do you solve a single source shortest-path problem?

By shift the direction of each edge in the graph, we can shorten this problem to a single - source problem. Single - pair shortest - path problem: Find the shortest path from u to v for given vertices u and v. If we determine the single - source problem with source vertex u, we clarify this problem also.

Which algorithm is best for single source shortest path?

Dijkstra's Algorithm This means, that rather than just finding the shortest path from the starting node to another specific node, the algorithm works to find the shortest path to every single reachable node – provided the graph doesn't change.

Which algorithm is the best to use to compute single source shortest paths on an unweighted graph?

Given a source vertex s from a set of vertices V in a weighted digraph where all its edge weights w(u, v) are non-negative, find the shortest path weights d(s, v) from source s for all vertices v present in the graph.

What is single source shortest path Dijkstra algorithm?

The Dijkstra Shortest Path algorithm computes the shortest path between nodes. The algorithm supports weighted graphs with positive relationship weights. The Dijkstra Single-Source algorithm computes the shortest paths between a source node and all nodes reachable from that node.


1 Answers

OSRM is using contraction hierarchies (CH) to be that fast for "one to one routing". To make CH working you need an adapted bidirectional algorithm (A*, Dijkstra, ...) so the single source case is more difficult. BUT a one to many algorithm is relative simple if you know up front which destinations you want.

Also have a look into the paper "Fast Detour Computation for Ride Sharing" or here if you want a solution for a "non goal-directed, bidirectional search" which uses lookup tables.

other free routing libraries?

I would suggest my Java GraphHopper project ;)

but there are of course more: http://wiki.openstreetmap.org/wiki/Routing

like image 186
Karussell Avatar answered Sep 28 '22 19:09

Karussell