Separator-Based Alternative Paths in Customizable Contraction Hierarchies
Abstract
We propose an algorithm for computing alternatives to the shortest path in a road network, based on the speed-up technique CCH (customizable contraction hierarchy). Computing alternative paths is a well-studied problem, motivated by the fact that route-planning applications benefit from presenting different high-quality options the user can choose from. Another crucial feature of modern routing applications is the inclusion of live traffic, which requires speed-up techniques that allow efficient metric updates. Besides CCH, the other speed-up technique supporting metric updates is CRP (customizable route planning). Of the two, CCH is the more modern solution with the advantages of providing faster queries and being substantially simpler to implement efficiently. However, so far, CCH has been lacking a way of computing alternative paths. While for CRP, the commonly used plateau method for computing alternatives can be applied, this is not so straightforward for CCH.
With this paper, we make CCH a viable option for alternative paths, by proposing a new separator-based approach to computing alternative paths that works hand-in-hand with the CCH data structure. With our experiments, we demonstrate that CCH can indeed be used to compute alternative paths efficiently. With this, we provide an alternative to CRP that is simpler and has lower query times.
Keywords and phrases:
Alternative routes, realistic road networks, customizable contraction hierarchies, route planning, shortest pathsCopyright and License:
2012 ACM Subject Classification:
Theory of computation Shortest paths ; Mathematics of computing Graph algorithms ; Applied computing TransportationSupplementary Material:
Software (Source Code): https://github.com/mzuenni/Separator-Based-Alternative-Paths-in-CCHsFunding:
This work was supported by funding from the pilot program Core-Informatics of the Helmholtz Association (HGF).Editors:
Jonas Sauer and Marie SchmidtSeries and Publisher:
Open Access Series in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Computing shortest paths in a graph is a fundamental problem in computer science, with practical relevance in a wide range of applications. One of the most prominent examples is interactive navigation systems. For this application, the default solution for efficiently computing shortest paths – Dijkstra’s algorithm [10] – is impractical due to the sheer size of real-world road networks. One can, however, make use of the fact that road networks do not change too frequently, which enables speed-up techniques that accelerate shortest-path queries via precomputation [3]. Beyond requiring fast shortest-path computations, modern navigation systems pose additional challenges. This includes real-time traffic updates and suggestions for alternative paths the user can choose from.
To formalize the concept of good alternatives to a shortest path Abraham, Delling, Goldberg, and Werneck [1] proposed a definition based on three properties.
-
1.
The set of alternatives should be diverse, i.e., each proposed alternative should be sufficiently unique compared to the shortest path and other alternatives in the set.
-
2.
The alternatives should have bounded stretch, i.e., they should never make big detours.
-
3.
The alternatives should not contain obvious detours, i.e., any subpath that is sufficiently short should be a shortest path.
Abraham et al. [1] also proposed the concept of via paths as a technique to compute alternative paths. The idea here is to obtain a candidate path from the start to the destination by concatenating shortest paths from to a via vertex and from to . For each such candidate alternative, one then has to check whether it actually satisfies the conditions for being a good alternative.
A common method to produce promising candidates for via vertices uses the concept of plateaus, which are subpaths shared by the shortest path trees of a forward search from the start and a backward search from the destination. The resulting via vertex candidates are promising in the sense that a large plateau guarantees that an alternative via the plateau has no obvious detour (Property 3). While there are other approaches to alternative paths like the penalty method [7] and compact representations of a large set of multiple alternatives [2, 14, 17], most previous approaches are based on plateaus [1, 15, 2, 8, 16].
In its most basic form, the plateau approach works as follows [1]. Run Dijkstra’s algorithm bidirectionally, i.e., forward from the start and backward from the destination. To just compute the shortest path, one could stop the searches once the shortest path has been found. To compute alternatives, let instead both searches run a bit longer, building larger and overlapping search trees, from which the plateaus can be extracted. With this, one obtains at least one admissible alternative for of shortest path queries [1]. As mentioned above, Dijkstra’s algorithm is prohibitively slow on large road networks, and running it longer than necessary does certainly not improve this. It is thus not surprising that most work on alternative paths is concerned with using speed-up techniques to improve efficiency. Note that this leads to diametrically opposite objectives: On the one hand, speed-up techniques aim to prune as much of the search space as possible, ideally exploring only the vertices on the shortest path during a query. On the other hand, to get candidates for via vertices, we explicitly want to find vertices that are not on the shortest path.
Nonetheless, various speed-up techniques have been successfully used for computing alternative paths. Abraham et al. [1] demonstrate how to compute high-quality alternatives based on Reach [12] and Contraction Hierarchies [11]. Luxen and Schieferdecker [16] further improved the query times reported by Abraham et al. at the cost of excessive precomputation and a significantly reduced number of found alternatives. Bader, Dees, Geisberger, and Sanders [2] introduced the concept of an alternative graph to efficiently encode the union of many alternatives. Paraskevopoulos and Zaroliagis further engineered this approach to achieve faster runtime[17] and Kobitzsch used the alternative graph to efficiently extract new alternatives [14].
In their paper introducing the speed-up technique CRP, Delling, Goldberg, Pajor, and Werneck [8] also evaluate how well their algorithm is suited to compute alternatives. Similar to the basic bidirectional approach mentioned above, they observe that relaxing the stopping-criterion of the search leads to the discovery of plateaus, which result in at least one admissible alternative for of the queries. This comes at the cost of a slow-down of only slightly above compared to a normal CRP query. We note that the result by Delling et al. [8] stands out in the sense that CRP (which is the abbreviation for customizable route planning) is the only approach that allows for efficient metric updates, which is essential as it enables features like real-time traffic updates.
While the technique customizable contraction hierarchy (CCH), introduced by Dibbelt, Strasser, and Wagner [9], is an alternative to CRP that also allows metric updates, CCHs have not yet been studied in terms of alternative paths. This is unfortunate, as except for the lacking feature of alternative paths, CCH is generally preferable compared to CRP. It is easier to implement, achieves an order of magnitude faster queries with the same preprocessing time [9], and has a stronger theoretical foundation [9, 19, 4]. With this paper, we study how CCHs also can be used to compute alternative paths.
Challenges, Contribution, and Outline.
As outlined above, a common approach to compute alternative paths is to run the normal shortest-path query longer than necessary to obtain plateaus. Our first observation is that this approach is not compatible with CCH: The CCH-query (at least in its basic form) runs upwards in a hierarchy defined by a so-called elimination tree until it reaches the root, without any preemptive stopping criterion; we refer the reader to Section 2.3 for a brief introduction to CCH. It follows that the strategy “run the query longer” is not well-defined for CCH, as there is nothing left to explore after reaching the root. Thus, instead of using plateaus, we propose a different approach to obtain good candidates for via vertices that is more aligned with the inner workings of CCH.
Our approach to find candidates for via vertices is based on separators. Assume that we are interested in alternative --paths and that is a separator that separates the start from the destination , i.e., removing the vertices in from the graph places and in different connected components. Then any --path must use one of the vertices from , making a set of promising candidates for via vertices. Interestingly, the above mentioned elimination tree of the CCH defines a hierarchy of separators. Moreover, the CCH query visits all vertices in the top-level separator that separates from . Thus, without any overhead compared to the normal CCH query, this provides us with a set of candidate via vertices. Additionally, the query already provides us with distances from and to the separator vertices, which already provides an upper bound to the stretch (Property 2). With little additional overhead (factor ), we can check all three properties properly.
Interestingly, the previously mentioned opposition – alternative paths requiring via vertices that are not on the shortest path vs. speed-up technique trying to reduce the search space – becomes apparent for CCHs. We observe that only considering the top-level separator for potential via vertices yields an admissible alternative in only of the queries. To improve upon this, we propose an algorithm that not only considers the top-level separator but also separators on lower levels. Going down just one level already yields an admissible alternative in and we achieve by going even deeper, which is competitive to the state-of-the-art. Compared to a normal CCH query, this comes at the cost of a running time increase by factors of and , respectively. This outperforms CRP, the only previous speed-up technique supporting alternative paths and efficient metric updates. Moreover, for finding two and three alternatives, we get success rates of and , which is a moderate improvement compared to CRP. Beyond the comparison to the state-of-the-art, we additionally provide experiments that foster the understanding of our algorithm, e.g., in terms of the trade-offs between running time and success rate.
2 Preliminaries
Let be a directed graph with vertices and edges . Moreover, let be weighted, i.e., we have a cost function 111For the purpose of the routing application, think of as the cost to traverse an edge. Most commonly is the travel time.. For a directed edge we refer to and as the tail and head, respectively. A sequence of edges is a path if the head of equals the tail of for . Let be the tail of and be the head of . Then we call an --path. Slightly abusing notation, we also use to refer to the set of edges in . For , we call a subpath of if appears consecutively in . Moreover, if is an --path for , then is called --subpath of .
We extend the cost function from individual edges to sets of edges (and in particular to paths), i.e., for we define . For a path , is called the length of . The distance between and in is the minimum length of an --path and is denoted by . In the remainder of this paper, we make the common assumption that there is only one --path of length and therefore call this path the shortest --path and denote it with .
2.1 Alternative Path Problem
Let be the shortest --path for . Following the definition by Abraham et al. [1], we say that an --path is an admissible alternative if it has limited sharing, bounded stretch, and local optimality, which are defined as follows, depending on parameters , , and , respectively.
-
1.
has limited sharing if .
-
2.
has bounded stretch if for every --subpath it holds that .
-
3.
is locally optimal if for every --subpath with , it holds that is the shortest --path, i.e., .
In case we do not want just one but multiple alternatives, we require limited sharing (Property 1) to not only hold for the shortest path but for the union of and all other alternatives. Thus, we call a set of alternative --paths admissible if each has bounded stretch (Property 2), is locally optimal (Property 3), and
We use the parameter values , , and typically used in the literature.
2.2 Checking Admissibility
As already noted in the literature [1], it is unknown how to check bounded stretch (Property 2) and local optimality (Property 3) without requiring quadratic time in the length of the path. It is thus common to not check the properties exactly but instead use the approaches described in the following.
For bounded stretch (Property 2), instead of checking every subpath , we only check the parts that deviate from the shortest path . More precisely, we check the --subpath if is maximal (with respect to inclusion) among the subpaths of that are edge-disjoint with the shortest path . For paths based on one via vertex , i.e., if is the concatenation of the shortest paths and , one can see that there is just one such --subpath; see Figure 1. More generally, for multiple via-vertices there is at most one such subpath for each via vertex.
For the local optimality (Property 3), we use the so-called T-test, which guarantees local optimality with respect to but sometimes falsely rejects alternatives if they are not locally optimal with respect to [1]. For this, consider a via vertex and let be the concatenation of the shortest paths and . Moreover, let and be the vertices on at distance from ; see Figure 1. The alternative passes the T-test if is the shortest --path.
2.3 Customizable Contraction Hierarchies
Here we introduce the concepts of CCH necessary to understand our alternative path algorithm. For a more general introduction and in-depth discussion, see the recent survey [5]. In general, CCH follows a three-phase approach: The first phase is a metric-independent preprocessing, i.e., a preprocessing of the graph , ignoring the cost function . This is the most costly phase, taking in the order of a few minutes for a continentally sized network, which is acceptable as the topology of rarely changes. The second step is the customization phase, where the cost function is preprocessed. Taking just a few seconds, this allows for frequent traffic updates. Finally, the third phase are the actual queries, which usually take less than a millisecond, exploiting the additionally information computed in the first two phases.
Given the graph , the CCH preprocessing computes the following two additional structures. First, it computes a hierarchy of small balanced separators that splits the graph recursively into pieces; see Figure 2 (left) for an illustration. This hierarchy is represented by a rooted tree called elimination tree; see Figure 2 (right). Let be one of the separators. Then forms a path in and only the bottom-most vertex of has multiple children. The different subtrees below these children contain the vertices from the different connected components that were separated by . From this, one can already make the following crucial observation: For two vertices and , let be the set of common ancestors of and in . Then, separates from (or contains one of the two) and thus any --path goes through a vertex of . Hence, to compute the distance , it suffices to compute the distances and for all and then choose the vertex that minimizes .
To achieve this, we need the second additional structure computed in the precomputation; the augmented graph . The augmented graph is obtained from by inserting additional edges, which are called shortcuts and represent paths. Explaining why this works is beyond the scope of this paper (see e.g., [5]), but adding shortcuts in a clever way yields the following crucial property. Let be any vertex and let be the path in the elimination tree from to the root . Now run Dijkstra’s algorithm, but instead of using a priority queue to decide which vertices to relax, only relax the vertices in that order. Then this computes the correct distances for all , i.e., for all ancestors of in the elimination tree . Running this type of search from and (backwards) from thus yields the distances and for every common ancestor of and , which yields the distance as noted above.
3 Separator Based Alternatives with CCH
Let be the graph for which we have built the CCH and let be the corresponding elimination tree. Moreover, let the start and the destination be given, and let be the set of common ancestors of and in . As outlined in Section 2.3, separates from . The idea of our basic approach is to use as the set of potential via vertices.
We believe that this is a rather natural set of candidates for via vertices: As separates from , every --path, and thus every alternative, has to go through a vertex in . Moreover, the separator hierarchy used for the CCH attempts to use small and balanced separators. Small separators mean that we do not have too many candidates to check, making the runtime acceptable. Balanced separation means that the separators lie somewhat in the middle between many --pairs, which intuitively makes for good via vertex candidates; see Figure 3 for examples. With the set of candidate via vertices , it remains to check for admissibility. More precisely, we need to select a subset of such that the corresponding alternatives form an admissible set of alternatives.
3.1 Selection of Via Vertices
To maximize the number of found alternatives, we would ideally check for each separator vertex whether the via vertex yields an admissible alternative. From the resulting set of individually admissible alternatives, one would then have to extract a maximum set of alternatives that are also admissible together (recall that the limited sharing property for sets of alternatives also depends on the other selected alternatives). As this is computationally too expensive, we instead use the following greedy strategy, which is also commonly used in the literature regarding alternative paths.
We iteratively process the alternatives defined by vertices in . When processing , we check whether the via path is admissible with respect to the already selected alternatives. If yes, we add it to the selection and discard it otherwise. We prioritize shorter alternatives, i.e., we process the candidates in the order of increasing length. We note that the CCH approach is very well suited for this. Recall that the CCH query computes and for every . Thus we already know the length of every via path without any overhead compared to the normal query.
It remains to check whether the next candidate path is admissible with respect to the already selected alternatives. To do this efficiently, we use four different checks that we apply in order of increasing computational cost. The reason for this is that, if an early cheap check already rules out a path, then we can save the later more expensive checks. The steps and how to implement them efficiently in the CCH approach are described in detail in the following. The first two steps check the bounded stretch requirement. The third step ensures limited sharing and the fourth and final step is the T-test checking for local optimality.


Total Stretch Pruning.
If an alternative is already longer than it will clearly violate the bounded stretch (Property 2). Since we process alternatives by increasing length this implies that all following alternatives will be too long as well, which allows us to return early. This property can also be used to speed up the standard CCH in the same fashion as proposed by Buchhold et al. [6]. They proposed that any vertex whose distance to either or already exceeds the length of the shortest path found so far can be skipped. In our setting, we can do the same pruning by additionally including the factor .
Bounded Stretch.
For the bounded stretch, we need to find the --subpath deviating from the shortest path as shown in Figure 1. In the following, we describe how to find ; determining works analogously.
Let be the common ancestors of and in the elimination tree and let be the via vertex we are currently interested in. From the CCH query, we already obtain the shortest paths in the augmented graph . Note that this path might still contain shortcut edges. The naive approach would be to unpack it and then check where the resulting path deviates from the shortest path. We can improve this by only unpacking the first edge on that deviates from the shortest path. We note that unpacking this edge once might again yield shortcut edges, which have to be unpacked recursively. However, in each step, we only have to unpack one edge. Once this deviating edge is an edge of , i.e., not a shortcut, we have found the vertex which is the tail of the edge. Moreover, during this unpacking, we can maintain the distance to . Thus, we not only find but also know and . With this checking the bounded stretch (Property 2) boils down to checking whether .
Limited Sharing.
To check limited sharing for the shortest path , observe that from the previous checks, we already know
Thus, Property 1 can be checked with almost no overhead.
If we have already selected other alternatives, we also have to check the sharing with them. For this, we actually compute in by fully unpacking the path found by the CCH, i.e., we transform a path in the augmented graph to a path in by replacing shortcuts with paths. To efficiently check sharing, we maintain the invariant that all edges along the shortest path and along all previous selected alternatives are marked. Computing the sharing is then done by summing over all marked edges along the unpacked path . Note that we can slightly improve the efficiency here by only summing over the detour and adding the distance and directly.
Local Optimality.
Performing the T-test is conceptually easy even though it is computationally expensive. We first determine the vertices and along closest to with distance at least . Then we perform a separate CCH query to compute and check if it is equal to . Note that determining , and is trivial because we already unpacked the path in the previous step.
After all tests are passed we add the alternative to our selection and mark all edges to maintain the invariant required by the limited sharing check.
3.2 Two-Step Approach
The biggest advantage of road networks for efficiently computing shortest paths – its small natural separators – can become a problem for our basic algorithm described above if the separators are too small. Figure 4 shows the example of London and Paris, which are separated by only a few vertices. The shortest path uses the Eurotunnel and the only possible way to avoid this is by using ferries which take too long to provide admissible alternatives. A similar issue can arise if the separator is too close to either or . In such a case most separator vertices already violate the global stretch and get pruned.


The goal in the following is to extend our approach to also provide admissible alternatives in these situations. For this, we use the following intuitive observation. The above scenario happens if the separator vertex used by the shortest path is too important to be avoided. Thus, we decide to keep and instead look for alternatives in the subpaths from to and from to . The basic idea is to consider these two sides of the separator as independent subproblems of the alternative path problem.
To make this more precise, let be the vertex on the shortest path that is closest to the root in the elimination tree . Moreover, let and be the two neighbors of in . Then we recursively call the basic algorithm to compute alternatives for to and to ; see Figure 5. It remains to fill out the following details. First, we have to describe how to combine the subpaths that are returned by the recursive calls. Secondly, we want the resulting alternatives to be admissible for the original query of and . While admissibility of the resulting paths can be checked when combining subpaths, we also have to adjust the requirements for admissibility in the recursive calls to not falsely prune promising subpaths or return subpaths that can never be completed to admissible alternatives.
Path Combination.
Assume we have recursively computed alternative paths from to and from to . As this typically does not yield too many paths, we consider every possible combination of these paths to obtain alternative --paths. As in the basic approach, the order in which we consider these paths might have an impact on the resulting set of alternatives. As before, we greedily add alternatives ordered by their length. We note that we can save some time here by sorting the paths by their length before unpacking them and stopping as soon as the constructed paths become larger than .
For each combination we consider, we have to check, whether it is admissible. For the bounded stretch, running the recursive call with the same already provides the check as described in Section 2.2, so there is nothing to do there.Checking the sharing is straight forward, by unpacking the path. Finally, for the local optimality, adjusting the -value appropriately in the recursive call (see one of the following paragraphs) makes sure that there are no local detours within the subpaths.Here we additionally run the T-test at the vertex to also ensure overall local optimality.
Limited Sharing in the Recursive Call.
Although limited sharing is ultimately tested when we combine the subpaths of the recursive calls, we can still exclude some alternative subpaths based on their sharing with the shortest path. For this, we only consider sharing with the shortest path (and not with other alternatives) in the recursive calls. Here we describe how we adjust in the recursive calls.
Let and be the start and destination of the recursive call. Our goal is to choose a such that the following property holds. If an alternative --path shares at least with the shortest path , then it should be safe to exclude as every combination using would have too much sharing with . We claim that this is achieved by setting
To see this, assume that the path is excluded due to the fact that . Plugging in the above definition for and slightly rearranging yields . Note that any combination involving clearly shares . Moreover, the subpath from to (consisting of just two edges) is also shared in every combination. Thus, it is fair to exclude as any combination with will fail the bounded shared check anyways.
Local Optimality in the Recursive Call.
Recall that the requirement for local optimality is relative to the distance , i.e., optimality is required for all subpaths between vertices at distance . To maintain the same guarantee in the recursive call, we run it with
Note that being locally optimal for relative to in the recursive call is equivalent to being locally optimal for relative to . We note that can become larger than . In this case we can stop the recursive call and just report the shortest path.
3.3 Recursive Approach
A natural extension to the two step approach is to not compute the paths from to and to with the basic approach but with the two step approach itself. More precisely, we first use the base algorithm, if that does not yield sufficiently many alternatives we go one recursion step deeper and afterwards combine the paths in the same way as in Section 3.2 This approach ensures that even multiple small separators between and can be handled while only doing more work if necessary. As a stopping condition for the recursive descend, we propose to stop as soon as the distance between the current start and destination becomes too small. More precisely we introduce the new parameter . The recursive call returns just the shortest path if is less than .
4 Experimental Evaluation
The main objective of this section is to evaluate the performance of our algorithmic approaches in regards to quality – measured by the number of found alternatives – and runtime. For this, we start with an algorithm comparison in Section 4.2. We focus on the comparison with CRP, which is the main competitor due to the fact that no other speed-up technique also supports efficient metric updates. Additionally, we will also see that our different variants provide a trade-off between success rate and runtime.
Afterwards we provide a more detailed look into the inner workings of our algorithm. In Section 4.3, we provide statistics on how many candidates for alternative paths are considered and due to which checks they are filtered out. There we will also see that almost no candidates are rejected due to too much sharing with previously selected paths, which serves as a justification to greedily select alternatives. In Section 4.4, we consider the impact of the separator hierarchy used in the CCH on the success rate. Finally, in Section 4.5, we study the trade-off between success rate and runtime the parameter in our recursive approach provides. Before we start with the actual evaluation, we briefly specify our experiment setup.
4.1 Experimental Setup
The input instance for all our experiments is the DIMACS Europe graph with travel-time as edge weights. The resulting graph has million vertices, million edges and represents the complete road network of west Europe around the year . We chose to use this graph even though larger networks are available since it is the main benchmark for various other route planning techniques and has also been used to evaluate all other alternative path techniques.
To make the comparison with the related work easier we copy the methodology introduced by Abraham et al. [1]. That is, we test our algorithm with the same parameters. More precisely, we require alternatives to be locally optimal for , have at most sharing, and bounded stretch of . Note that these are hard constraints and any alternative satisfying them is considered good. Thus, the quality of the algorithm can be measured by the success rate of finding alternatives. Additionally, we will consider the time required to find those alternatives. If not stated otherwise all numbers are averaged over random queries.
Our algorithms are implemented in C++17 and compiled with the GNU compiler using optimization level . Our test machine runs Fedora (kernel ), and has GiB of DDR4-4266 RAM and a AMD Ryzen PRO U CPU with cores clocked at Ghz and KiB of L1, MiB of L2, and MiB of L3 cache.
| first | second | third | ||||
| success [%] | time [ms] | success [%] | time [ms] | success [%] | time [ms] | |
| X-BDV | 94.5 | 26 352.0 | 81.1 | 29 795.0 | 61.6 | 33 443.0 |
| X-REV-1 | 91.3 | 20.4 | 70.3 | 33.6 | 43.0 | 42.6 |
| X-REV-2 | 94.2 | 24.3 | 79.0 | 50.3 | 56.9 | 64.9 |
| X-CHV-3 | 90.7 | 16.9 | 70.1 | 20.3 | 42.3 | 22.1 |
| X-CHV-5 | 92.9 | 55.2 | 77.0 | 65.0 | 53.3 | 73.2 |
| X-CHASEV | 75.5 | 0.5 | 40.2 | 0.7 | 14.2 | 1.0 |
| two-level | 80.5 | 0.1 | 50.8 | 0.3 | 24.8 | 0.4 |
| multi-level | 81.2 | 0.1 | 51.2 | 0.3 | 25.0 | 0.4 |
| HiDAR | 91.5 | 18.2 | 75.5 | 18.2 | 55.9 | 18.2 |
| CRP | 90.9 | 5.8 | 65.4 | 3.3 | 39.2 | 3.4 |
| SeArCCH | 65.3 | 0.5 | 37.3 | 0.7 | 17.2 | 1.0 |
| two-step | 84.1 | 1.1 | 62.9 | 1.6 | 38.7 | 2.3 |
| recursive | 90.0 | 2.3 | 68.6 | 4.2 | 44.7 | 6.0 |
4.2 Algorithm Comparison
Unfortunately, no implementations of the competitor algorithms are freely available and the queries used during their respective evaluations were not published. To nonetheless make a comparison possible, we report the success rates and computation times from the related work in Table 1. The success rate for represents the fraction of queries, for which an admissible set of alternatives of size at least was found. Even though the numbers are based on different sets of sampled queries, the success rates should be comparable since they are averaged over at least queries. The timings on the other hand should not be compared directly; see the more detailed discussion of the running time below.
We want to note that CRP and our approach are arguably the most practically relevant approaches due to their support for efficient metric updates. We thus focus our discussion on the comparison to CRP. The other approaches listed in Table 1 are included for completeness.
Success Rates.
The algorithm X-BDV can be considered as the baseline in terms of success rate, since it checks all admissible alternatives that use a single via vertex. Even though this approach is infeasible for real applications it shows what success rates are achievable. Based on the related work we consider as success rate of as desirable for the first alternative. As we can see in Table 1 this is achieved by our recursive approach (with ). Moreover, the two-step approach is with already close to this goal while being significantly faster. For the second and the third alternative, our approaches performs slightly worse than the baseline. However, compared to CRP, we obtain slightly higher success rates: We get an improvement from to and from to for the second and third alternative, respectively.
Runtime.
For the runtime comparison with CRP, our recursive variant is the most relevant, as it achieves comparable success rates. Additionally, it is also interesting to compare the runtime with our two-step approach, which has only slightly worse success rates. We want to note that, ideally, we could run comparison experiments for CRP on the same machine. Unfortunately, the implementation is not publicly available and building a competitive CRP implementation is highly non-trivial. Nonetheless, we believe that we can draw the conclusion that our algorithm outperforms CRP.
To make the comparison, we start with the base algorithms CCH and CRP and consider the slowdown encountered by additionally computing alternative paths. For the base algorithms, it is already well established that the query of CCH is a magnitude faster than CRP’s query [9]. Moreover, for CRP, Delling et al. [8] report a slowdown of at least for computing alternatives. Thus, even with a slowdown of , we would still obtain a competitive performance. We can report a runtime of for the basic CCH query. Compared to this, our recursive algorithm computing alternatives leads to slowdowns of for the first, for the second, and for the third alternative. With these numbers, we can safely conclude that our approach is at least on par with CRP and faster most of the time. We also note that our two-step approach with a success rate of for the first alternative has only a slowdown of . With the above estimation, we expect this to be at least times faster than CRP. We note that the two-step variant forms the initial part of recursive. Thus, in the of the queries where two-step finds an alternative, recursive also finds the first alternative in the same time.
4.3 Checking Admissibility of Candidates
Recall that our algorithm starts with a set of candidates for alternative paths, which are then filtered by different checks ensuring the resulting set of alternatives is admissible. Figure 6 shows for our basic (non-recursive) approach, how many candidates pass which check before we find the first, second, or third alternative (after finding the previous alternative). The first bar indicates the number of considered candidate paths that have overall length at most . The second bar shows how many of those have bounded stretch (property 2). The third bar shows the number of checked candidates additionally having limited sharing with the shortest path and the fourth bar is obtained by additionally requiring limited sharing with all previously selected alternatives (property 1). Finally, the fifth bar indicates the average number of paths also passing the T-test (property 3), which coincides with the fraction of queries finding at least one, two, or three alternatives.
One can clearly see that most considered candidates are rejected due to the stretch. For the second and third alternative, the T-test additionally rules out a big fraction of candidates. Note that only very few checked candidates are rejected due to too much sharing with previously selected alternatives.
We believe that the last observation is particularly interesting for the following reason. While the alternative path problem ensures high-quality alternatives by requiring admissibility (hard constraints), the optimization goal is to maximize the number of found alternatives. However, our approach follows the literature by greedily adding alternative paths to the set of alternatives, prioritizing shorter paths. A better approach to maximize the number of alternatives might be to somehow select the alternatives based on how much they share with candidates that are considered later. However, the fact that there is almost no difference between the third and fourth bars in Figure 6 shows that earlier selected alternatives very rarely make later candidates non-admissible due to a large overlap. This justifies the decision to select alternatives greedily by length instead of trying to explicitly maximize their number.
4.4 Impact of the Separator Hierarchy
An important degree of freedom in CCH is the used separator hierarchy. Except when explicitly stated otherwise, we use the state-of-the-art algorithm InertialFlowCutter222https://github.com/kit-algo/InertialFlowCutter engineered by Gottesbüren, Hamann, Uhl and Wagner in the default configuration [13]. This can be seen as the the default choice for high-performance CCHs. However, as already mentioned in Section 1, larger separators (which are worse for performance) provide more candidates for via vertices. For comparison, we thus additionally ran our alternative path algorithm using separators provided by the simpler InertialFlow algorithm proposed by Schild and Sommer [18], using the implementation in RoutingKIT333https://github.com/RoutingKit/RoutingKit in the default configuration.
Figure 7 shows the number of alternatives found by the basic (non-recursive) variant of our algorithm for the different separator hierarchies. We can see that, indeed, the number of found alternatives slightly increases with the larger separators. Thus, in principle, choosing different separators provides a trade-off between quality and runtime. However, since the effect is quite small, we suggest using the InertialFlowCutter separators together with our recursive algorithm, which also provides a trade-off between quality and runtime, as discussed in the next section.
4.5 Impact of the Recursion Parameter
Figure 8 shows the trade-off between success rate and runtime of our recursive algorithm depending on the parameter . In the right plot, we can clearly see that less recursive calls (i.e., larger ) yields lower runtimes. The plot on the left shows that the success rate already starts on a high level for large , which agrees with our previous observation that the two-step variant444We note that the two-step variant is incomparable with the recursive variant. The two-step variant always makes two recursive calls, one for each subpath on the top level. The recursive variant might, e.g., make multiple nested recursive calls but always only for one of the two subpaths. already yields good results. From this high level, the success rate further increases for smaller . A success rate of at least for the first alternative is obtained for and with , we obtain a runtime of just below . As is comparable with the state-of-the-art, we suggest and use as the default value.
5 Conclusion and Future Work
We have demonstrated that the speed-up technique CCH is well suited to compute alternative paths, resulting in an algorithm that is competitive with the state-of-the-art in performance and quality. With our implementation, we provide the first publicly available data structure that combines highly efficient queries for shortest paths and alternative paths with fast metric updates, which hopefully enables future research on the topic. As future directions, we believe it would be interesting to further explore how multiple via vertices can lead to more alternatives, in particular in cases where currently no single-via alternative is available. It would also be interesting to see if this can be used to beat the commonly used baseline algorithm, which is restricted to single-via alternatives. Concerning the baseline, we believe that it would also be interesting to develop exact algorithms for testing whether there exists an admissible alternative, even if this would prove computationally too expensive for actual applications.
References
- [1] Ittai Abraham, Daniel Delling, Andrew V. Goldberg, and Renato F. Werneck. Alternative routes in road networks. Journal of Experimental Algorithmics (JEA), 2013. doi:10.1145/2444016.2444019.
- [2] Roland Bader, Jonathan Dees, Robert Geisberger, and Peter Sanders. Alternative route graphs in road networks. In International Conference on Theory and Practice of Algorithms in (Computer) Systems, 2011. doi:10.1007/978-3-642-19754-3_5.
- [3] Hannah Bast, Daniel Delling, Andrew V. Goldberg, Matthias Müller-Hannemann, Thomas Pajor, Peter Sanders, Dorothea Wagner, and Renato F. Werneck. Route planning in transportation networks. In Algorithm Engineering: Selected Results and Surveys, Lecture Notes in Computer Science. Springer, 2016. doi:10.1007/978-3-319-49487-6_2.
- [4] Reinhard Bauer, Tobias Columbus, Ignaz Rutter, and Dorothea Wagner. Search-space size in contraction hierarchies. Theoretical Computer Science, 2016. doi:10.1016/j.tcs.2016.07.003.
- [5] Thomas Bläsius, Valentin Buchhold, Dorothea Wagner, Tim Zeitz, and Michael Zündorf. Customizable contraction hierarchies – a survey, 2025. doi:10.48550/arXiv.2502.10519.
- [6] Valentin Buchhold, Peter Sanders, and Dorothea Wagner. Real-time traffic assignment using engineered customizable contraction hierarchies. ACM Journal of Experimental Algorithmics, 2019. doi:10.1145/3362693.
- [7] Yanyan Chen, Michael GH Bell, and Klaus Bogenberger. Reliable pretrip multipath planning and dynamic adaptation for a centralized road navigation system. IEEE Transactions on Intelligent Transportation Systems, 2007.
- [8] Daniel Delling, Andrew V. Goldberg, Thomas Pajor, and Renato F. Werneck. Customizable route planning in road networks. Transportation Science, 2017. doi:10.1287/trsc.2014.0579.
- [9] Julian Dibbelt, Ben Strasser, and Dorothea Wagner. Customizable contraction hierarchies. ACM Journal of Experimental Algorithmics, 2016. doi:10.1145/2886843.
- [10] Edsger W. Dijkstra. A note on two problems in connexion with graphs. Numerische Mathematik, 1959. doi:10.1145/3544585.3544600.
- [11] Robert Geisberger, Peter Sanders, Dominik Schultes, and Christian Vetter. Exact routing in large road networks using contraction hierarchies. Transportation Science, 2012. doi:10.1287/trsc.1110.0401.
- [12] Andrew V Goldberg, Haim Kaplan, and Renato F Werneck. Reach for A*: Shortest path algorithms with preprocessing. In The shortest path problem, 2006.
- [13] Lars Gottesbüren, Michael Hamann, Tim Niklas Uhl, and Dorothea Wagner. Faster and better nested dissection orders for customizable contraction hierarchies. Algorithms, 2019. doi:10.3390/a12090196.
- [14] Moritz Kobitzsch. An alternative approach to alternative routes: Hidar. In European Symposium on Algorithms, 2013. doi:10.1007/978-3-642-40450-4_52.
- [15] Cambridge Vehicle Information Technology Ltd. Choice routing, 2009. URL: http://www.camvit.com.
- [16] Dennis Luxen and Dennis Schieferdecker. Candidate sets for alternative routes in road networks. In International Symposium on Experimental Algorithms, Lecture Notes in Computer Science, 2012. doi:10.1007/978-3-642-30850-5_23.
- [17] Andreas Paraskevopoulos and Christos Zaroliagis. Improved alternative route planning. In ATMOS-13th Workshop on Algorithmic Approaches for Transportation Modelling, Optimization, and Systems-2013, 2013. doi:10.4230/OASIcs.ATMOS.2013.108.
- [18] Aaron Schild and Christian Sommer. On balanced separators in road networks. In Proceedings of the 14th International Symposium on Experimental Algorithms (SEA’15), 2015. doi:10.1007/978-3-319-20086-6_22.
- [19] Ben Strasser and Dorothea Wagner. Graph fill-in, elimination ordering, nested dissection and contraction hierarchies. In Gems of Combinatorial Optimization and Graph Algorithms. Springer, 2015. doi:10.1007/978-3-319-24971-1_7.
