3 Route Planning in Road Networks
In this section, we experimentally evaluate how the techniques discussed so far perform in road networks. Moreover, we discuss applications of some of the techniques, as well as alternative settings such as databases or mobile devices.
3.1 Experimental Results
Our experimental analysis considers carefully engineered implementations, which is very important when comparing running times. They are written in C++ with custom-built data structures. Graphs are represented as adjacency arrays [190], and priority queues are typically binary heaps, 4- heaps, or multilevel buckets. As most arcs in road networks are bidirectional, state-of-the-art implementations use edge compression [233]: each road segment is stored at both of its endpoints, and each occurrence has two flags indicating whether the segment should be considered as an incoming and/or outgoing arc. This representation is compact and allows efficient iterations over incoming and outgoing arcs.
We give data for two models. The simplified model ignores turn restrictions and penalties, while the realistic model includes the turn information [255]. There are two common approaches to deal with turns. The arc-based representation [59] blows up the graph so that roads become vertices and feasible turns become arcs. In contrast, the compact representation [76,144] keeps intersections as vertices, but with associated turn
tables. One can save space by sharing turn tables among many vertices, since the number of intersection types in a road network is rather limited. Most speedup techniques can be used as is for the arc-based representation, but may need modification to work on the compact model.
Most experimental studies are restricted to the simplified model. Since some algorithms are more sensitive to how turns are modeled than others, it is hard to extrapolate these results to more realistic networks. We therefore consider experimental results for each model separately.
3.1.1 Simplified Model
An important driving force behind the research on speedup techniques for Dijkstra’s algorithm was its application to road networks. A key aspect for the success of this research effort was the availability of continent-sized benchmark instances. The most widely used instance has been the road network of Western Europe from PTV AG, with 18.0 million vertices and 42.5 million directed arcs. Besides ferries (for which the traversal time was given), it has 13 road categories. Category i has been assigned an average speed of 10 i km/h. This synthetic assignment is consistent with more realistic proprietary data [77,82]. Another popular (and slightly bigger) instance, representing the TIGER/USA road network, is undirected and misses several important road segments [6]. Although the inputs use the simplified model, they allowed researchers from various groups to run their algorithms on the same instance, comparing their performance. In particular, both instances were tested during the DIMACS Challenge on Shortest Paths [101].
Figure 7 succinctly represents the performance of previously published implementations of various point-to-point algorithms on the Western Europe instance, using travel time as the cost function. For each method, the plot relates its preprocessing and average query times. Queries compute the length of the shortest path (but not its actual list of edges) between sources and targets picked uniformly at random from the full graph. For readability, space consumption (a third important quality measure) is not
Figure 7. Preprocessing and average query time performance for algorithms with available experimental data on the road network of Western Europe, using travel times as edge weights. Connecting lines indicate different trade-offs for the same algorithm. The figure is inspired by [238].
explicitly represented.1 We reproduce the numbers reported by Bauer et al. [40] for Reach, HH, HNR, ALT, (bidirectional) Arc Flags, REAL, HH*, SHARC, CALT, CHASE, ReachFlags and TNR+AF. For CHASE and Arc Flags, we also consider variants with quicker PHAST-based preprocessing [75]. In addition, we consider the recent ALT implementation by Efentakis and Pfoser [112]. Moreover, we report results for several variants of TNR [15,40], Hub Labels [5,82], HPML [83], Contraction Hierarchies (CH) [142], and Customizable Contraction Hierarchies (CCH) [107]. CRP (and the corresponding PUNCH) figures [77] use a more realistic graph model that includes turn costs. For reference, the plot includes unidirectional and bidirectional implementations of Dijkstra’s algorithm using a 4-heap. (Note that one can obtain a 20% improvement when using a multilevel bucket queue [147].) Finally, the table-lookup figure is based on the time of a single memory access in our reference machine and the precomputation time of |V | shortest path trees using PHAST [75]. Note that a machine with more than one petabyte of RAM (as required by this algorithm) would likely have slower memory access times.
1The reader is referred to Sommer [238] for a similar plot (which inspired ours) relating
Times in the plot are on a single core of an Intel X5680 3.33 GHz CPU, a mainstream server at the time of writing. Several of the algorithms in the plot were originally run on this machine [5,75,77,82]; for the remaining, we divide by the following scaling factors: 2.322 for [40,83], 2.698 for [142], 1.568 for [15], 0.837 for [107], and 0.797 for [112]. These were obtained from a benchmark (developed for this survey) that measures the time of computing several shortest path trees on the publicly available USA road network with travel times [101]. For the machines we did not have access to, we asked the authors to run the benchmark for us [112]. The benchmark is available from http://algo.iti.kit.edu/~pajor/survey/ , and we encourage future works to use it as a base to compare (sequential) running times with existing approaches.
The figure shows that there is no best technique. To stress this point, techniques with at least one implementation belonging to the Pareto set (considering preprocessing time, query time, and space usage) are drawn as solid circles; hollow entries are dominated. The Pareto set is
query times to preprocessing space.
Table 1. Performance of various speedup techniques on Western Europe. Column source indicates the implementation tested for this survey.
| data stru | ctures | qu | eries | ||
|---|---|---|---|---|---|
| algorithm | impl. source | space [GiB] | time [h:m] | scanned vertices | time [µs] |
| Dijkstra | [75] | 0.4 | – | 9 326 696 | 2 195 080 |
| Bidir. Dijkstra | [75] | 0.4 | – | 4 914 804 | 1 205 660 |
| CRP | [77] | 0.9 | 1:00 | 2 766 | 1 650 |
| Arc Flags | [75] | 0.6 | 0:20 | 2 646 | 408 |
| CH | [77] | 0.4 | 0:05 | 280 | 110 |
| CHASE | [75] | 0.6 | 0:30 | 28 | 5.76 |
| HLC | [82] | 1.8 | 0:50 | – | 2.55 |
| TNR | [15] | 2.5 | 0:22 | – | 2.09 |
| TNR+AF | [40] | 5.4 | 1:24 | – | 0.70 |
| HL | [82] | 18.8 | 0:37 | – | 0.56 |
| HL-∞ | [5] | 17.7 | 60:00 | – | 0.25 |
| table lookup | [75] | 1 208 358.7 | 145:30 | – | 0.06 |
quite large, with various methods allowing for a wide range of space-time trade-offs. Moreover, as we shall see when examining more realistic models, these three are not the only important criteria for real-world applications.
Table 1 has additional details about the methods in the Pareto set, including two versions of Dijkstra’s algorithm, one Dijkstra-based hierarchical technique (CH), three non-graph-based algorithms (TNR, HL, HLC), and two combinations (CHASE and TNR+AF). For reference, the table also includes a goal-directed technique (Arc Flags) and a separator-based algorithm (CRP), even though they are dominated by other methods. All algorithms were rerun for this survey on the reference machine (Intel X5680 3.33 GHz CPU), except those based on TNR, for which we report scaled results. All runs are single-threaded for this experiment, but note that all preprocessing algorithms could be accelerated using multiple cores (and, in some cases, even GPUs) [75,144].
For each method, Table 1 reports the total amount of space required by all data structures (including the graph, if needed, but excluding extra information needed for path unpacking), the total preprocessing time, the number of vertices scanned by an average query (where applicable) and the average query time. Once again, queries consist of pairs of vertices picked uniformly at random. We note that all methods tested can be parametrized (typically within a relatively narrow band) to achieve different trade-offs between query time, preprocessing time, and space. For simplicity, we pick a single “reasonable” set of parameters for each method. The only exception is HL- ∞ , which achieves the fastest reported query times but whose preprocessing is unreasonably slow.
Observe that algorithms based on any one of the approaches considered in Section 2 can answer queries in milliseconds or less. Separator-based (CRP), hierarchical (CH), and goal-directed (Arc Flags) methods do not use much more space than Dijkstra’s algorithm, but are three to four orders of magnitude faster. By combining hierarchy-based pruning and goal direction, CHASE improves query times by yet another order of magnitude, visiting little more than the shortest path itself. Finally, when a higher space overhead is acceptable, non-graph-based methods can be more than a million times faster than the baseline. In particular, HL- ∞ is only 5 times slower than the trivial table-lookup method, where a query consists of a single access to main memory. Note that the table-lookup method itself is impractical, since it would require more than one petabyte of RAM.
The experiments reported so far consider only random queries, which tend to be long-range. In a real system, however, most queries tend to be local. For that reason, Sanders and Schultes [223] introduced a methodology based on Dijkstra ranks. When running Dijkstra’s algorithm from a vertex s, the rank of a vertex u is the order in which it is taken from the priority queue. By evaluating pairs of vertices for Dijkstra ranks 21 , 22 , . . . , 2⌊log|V |⌋ for some randomly chosen sources, all types (local, mid-range, global) of queries are evaluated. Figure 8 reports the median running times for all techniques from Table 1 (except TNR+AF, for which such numbers have never been published) for 1 000 random sources and Dijkstra ranks ≥ 26 . As
Figure 8. Performance of speedup techniques for various Dijkstra ranks.
expected, algorithms based on graph searches (including Dijkstra, CH, CRP, and Arc Flags) are faster for local queries. This is not true for boundedhop algorithms. For TNR, in particular, local queries must actually use a (significantly slower) graph-based approach. HL is more uniform overall because it never uses a graph.
3.1.2 Realistic Setting
Although useful, the results shown in Table 1 do not capture all features that are important for real-world systems. First, systems providing actual driving directions must account for turn costs and restrictions, which the simplified graph model ignores. Second, systems must often support multiple metrics (cost functions), such as shortest distances, avoid U-turns, avoid/prefer freeways, or avoid ferries; metric-specific data structures should therefore be as small as possible. Third, query times should be robust to the choice of cost functions: the system should not time out if an unfriendly cost function is chosen. Finally, one should be able to incorporate a new cost function quickly to account for current traffic conditions (or even user preferences).
CH has the fastest preprocessing among the algorithms in Table 1 and its queries are fast enough for interactive applications. Its performance degrades under realistic constraints [77], however. In contrast, CRP was developed with these constraints in mind. As explained in Section 2.3, it splits its preprocessing phase in two: although the initial metric-independent phase is relatively slow (as shown in Table 1), only the subsequent (and fast) metric-dependent customization phase must be rerun to incorporate a new metric. Moreover, since CRP is based on edge separators, its performance is (almost) independent of the cost function.
Table 2 (reproduced from [77]) compares CH and CRP with and without turn costs, as well as for travel distances. The instance tested is the same in Table 1, augmented by turn costs (set to 100 seconds for U- turns and zero otherwise). This simple change makes it almost as hard as fully realistic (proprietary) map data used in production systems [77]. The table reports metric-independent preprocessing and metric-dependent customization separately; “DS” refers to the data structures shared by all metrics, while “custom” refers to the additional space and time required by each individual metric. Unlike in Table 1, space consumption also includes data structures used for path unpacking. For queries, we report the time to get just the length of the shortest path ( dist), as well as the total time to retrieve both the length and the full path ( path). Moreover, preprocessing (and customization) times refer to multi-threaded executions on 12 cores; queries are still sequential.
As the table shows, CRP query times are very robust to the cost function and the presence of turns. Also, a new cost function can be applied in roughly 370 ms, fast enough to even support user-specific cost functions. Customization times can be even reduced to 36 ms with GPUs [87], also reducing the amount of data stored in main memory by a factor of 6. This is fast enough for setting the cost function at query time, enabling realistic personalized driving directions on continental scale. If GPUs are not available or space consumption is an issue, one can drop the contractionbased customization. This yields customization times of about one second on a 12-core CPU, which is still fast enough for many scenarios. In contrast, CH performance is significantly worse on metrics other than travel times without turn costs.
We stress that not all applications have the same requirements. If only good estimates on travel times (and not actual paths) are needed, ignoring turn costs and restrictions is acceptable. In particular, ranking POIs according to travel times (but ignoring turn costs) already gives much better results than ranking based on geographic distances. Moreover, we note that CH has fast queries even with fully realistic turn costs. If space (for the expanded graph) is not an issue, it can still provide a viable solution to the static problem; the same holds for related methods such as HL and HLC [82]. For more dynamic scenarios, CH preprocessing can be made parallel [144] or even distributed [168]; even if run sequentially, it is fast enough for large metropolitan areas.
3.2 Applications
As discussed in Section 2.7, many speedup techniques can handle more than plain point-to-point shortest path computations. In particular, hierarchical techniques such as CH or CRP tend to be quite versatile, with many established extensions.
Some applications may involve more than one path between a source and a target. For example, one may want to show the user several “reasonable” paths (in addition to the shortest one) [60]. In general, these alternative paths should be short, smooth, and significantly different from the shortest path (and other alternatives). Such paths can either be computed directly as the concatenation of partial shortest paths [6,60,77,173,184] or compactly
Table 2. Performance of Contraction Hierarchies and CRP on a more realistic instance, using different graph representations. Preprocessing and customization times are given for multi-threaded execution on a 12-core server, while queries are run single-threaded.
| CH | CRP | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| metric | turn info | D time [h:m] | S space [GiB] | q nmb. scans | uerie dist [ms] | s path [ms] | D time [h:m] | S space [GiB] | cus time [s] | tom space [GiB] | q nmb. scans | uerie dist [ms] | s path [ms] |
| dist | none | 0:12 | 0.68 | 858 | 0.87 | 1.07 | 0:12 | 3.11 | 0.37 | 0.07 | 2942 | 1.91 | 2.49 |
| time | none | 0:02 | 0.60 | 280 | 0.11 | 0.21 | 0:12 | 3.11 | 0.37 | 0.07 | 2766 | 1.65 | 1.81 |
| arc-based | 0:23 | 3.14 | 404 | 0.20 | 0.30 | – | – | – | – | – | – | – | |
| compact | 0:29 | 1.09 | 1998 | 2.27 | 2.37 | 0:12 | 3.11 | 0.37 | 0.07 | 3049 | 1.67 | 1.85 |
represented as a small graph [17,174,213]. A related problem is to compute a corridor [86] of paths between source and target, which allows deviations from the best route (while driving) to be handled without recomputing the entire path. These robust routes can be useful in mobile scenarios with limited connectivity. Another useful tool to reduce communication overhead in such cases is route compression [31].
Extensions that deal with nontrivial cost functions have also been considered. In particular, one can extend CH to handle flexible arc restrictions [140] (such as height or weight limitations) or even multiple criteria [133, 138] (such as optimizing costs and travel time). Minimizing the energy consumption of electric vehicles [43, 44, 122, 152, 240, 241] is another nontrivial application, since batteries are recharged when the car is going downhill. Similarly, optimal cycling routes must take additional constraints (such as the amount of uphill cycling) into account [239].
The ability of computing many (batched) shortest paths fast enables interesting new applications. By quickly analyzing multiple candidate shortest paths, one can efficiently match GPS traces to road segments [119, 121]. Traffic simulations also benefit from acceleration techniques [183], since they must consider the likely routes taken by all drivers in a network.
Another application is route prediction [177]: one can estimate where a vehicle is (likely) headed by measuring how good its current location is as a via point towards each candidate destination. Fast routing engines allow more locations to be evaluated more frequently, leading to better predictions [2, 121, 162, 176]. Planning placement of charging stations can also benefit from fast routing algorithms [132]. Another important application is ride sharing [2,110,139], in which one must match a ride request with the available offer in a large system, typically by minimizing drivers’ detours.
Finally, batched shortest-path computations enable a wide range of pointof-interest queries [2,99,114,119,137,179,221,259]. Typical examples include finding the closest restaurant to a given location, picking the best post office to stop on the way home, or finding the best meeting point for a group of friends. Typically using the bucket-based approach (cf. Section 2.7.2), fast routing engines allow POIs to be ranked according to network-based cost functions (such as travel time) rather than geographic distances. This is crucial for accuracy in areas with natural (or man-made) obstacles, such as mountains, rivers, or rail tracks. Note that more elaborate POI queries must consider concatenations of shortest paths. One can handle these efficiently using an extension of the bucket-based approach that indexes pairs of vertices instead of individual ones [2,99].
3.3 Alternative Settings
So far, we have assumed that shortest path computations take place on a standard server with enough main memory to hold the input graph and the auxiliary data. In practice, however, it is often necessary to run (parts of) the routing algorithm in other settings, such as mobile devices, clusters, or databases. Many of the methods we discuss can be adapted to such scenarios.
Of particular interest are mobile devices, which typically are slower and (most importantly) have much less available RAM. This has motivated external memory implementation of various speedup techniques, such as ALT [150], CH [226], and time-dependent CH [167]. CH in particular is quite practical, supporting interactive queries by compressing the routing data structures and optimizing their access patterns.
Relational databases are another important setting in practice, since they allow users to formulate complex queries on the data in SQL, a popular and expressive declarative query language [230].
Unfortunately, the table-based computational model makes it hard (and inefficient) to implement basic data structures such as graphs or even priority queues. Although some distance oracles based on geometric information could be implemented on a database [229], they are approximate and very expensive in terms of time and space, limiting their applicability to small instances. A better solution is to use HL, whose queries can very easily be expressed in SQL, allowing interactive applications based on shortest path computations entirely within a relational database [2].
For some advanced scenarios, such as time-dependent networks, the preprocessing effort increases quite a lot compared to the time-independent scenario. One possible solution is to run the preprocessing in a distributed fashion. One can achieve an almost linear speedup as the number of machine increases, for both CH [168] and CRP [116].