# Beyond Dijkstra: Evaluating Hyperbolic Embedding and 2-Hop Labeling for Shortest Path Routing on Large Road Networks

- Authors: Krrish Choudhary
- Published: 2026-06-17
- Tags: Algorithms
- Web page: https://verace.in/research/beyond-dijkstra-shortest-path-routing

## Abstract

Finding shortest paths in large-scale graphs is a fundamental problem in computer science. While Dijkstra’s algorithm remains the standard for SSSP queries, its computational complexity is a major bottleneck in real-time networks. In this paper, we evaluate two alternative routing paradigms designed to replace global priority-queue traversal: Hyperbolic Geodesic Coordinate Routing (HGCR), a continuous geometric model, and Isometric Hub-Label Routing (IHLR), a discrete algebraic model based on 2-hop covers. Using a 1,000-node sub-sampled region of the official 9th DIMACS New York Road Network benchmark, we evaluate query latency, search space reduction, and path stretch (optimality). Our results demonstrate that while HGCR reduces query time by 91.6% at the cost of a $6.01\times$ path stretch, IHLR achieves a 54.7% reduction in query latency and a 94.3% reduction in search operations with exactly 1.000 (perfectly optimal) path stretch, offering a robust, state-of-the-art (SOTA) replacement for Dijkstra’s algorithm.

## 1. Introduction

The classical single-source shortest path (SSSP) and single-pair shortest path (SPSP) problems form the backbone of modern transit planning, packet routing, and network analysis. Dijkstra’s algorithm (1959) solves SSSP optimally by greedily visiting nodes in order of their tentative distance using a priority queue. However, Dijkstra’s algorithm is inherently sequential and requires scanning large portions of the network topology, scaling poorly as the number of vertices $V$ and edges $E$ grow.

To overcome this, modern routing systems rely on speedup heuristics. These speedups generally fall into two categories:

1. **Geometric Embeddings:** Mapping nodes to coordinates in continuous metric spaces where pathfinding reduces to local greedy distance minimization.
2. **Algebraic / Topological Indexes:** Precomputing distance metrics between pairs of nodes to answer point-to-point queries algebraically in $O(1)$ or $O(L)$ time.

In this work, we implement, benchmark, and compare two specific realizations of these paradigms against standard Dijkstra’s algorithm:

- **HGCR (Hyperbolic Geodesic Coordinate Routing):** Coordinates nodes in a 5-dimensional Poincaré Hyperbolic Ball $\mathbb{D}^5$ using Riemannian Stochastic Gradient Descent (RSGD).
- **IHLR (Isometric Hub-Label Routing):** Constructs discrete label dictionaries for each node via Pruned Landmark Labeling (PLL) to perform optimal local routing.

![System architecture comparing offline precomputation of metric indices with the fast query phase.](<https://verace.in/research/beyond-dijkstra-shortest-path-routing/figures/figure-1.webp>)

Figure 1: System architecture comparing offline precomputation of metric indices with the fast query phase.

## 2. Theoretical Background & Related Work

### Hyperbolic Embedding

Hyperbolic space has constant negative curvature and exhibits exponential volume growth. This property makes it uniquely suited for representing hierarchical structures and graphs with power-law degree distributions. Kleinberg (2007) proved that any tree can be embedded into the 2D hyperbolic plane ($\mathbb{H}^2$) such that greedy routing is guaranteed to succeed.

However, general graphs containing dense cycles cannot be embedded into low-dimensional space without metric distortion. According to **Bourgain’s Theorem (1985)**, any embedding of a general metric space on $V$ points into a Euclidean (or Hilbert) space has a worst-case distortion (stretch) bounded by $\Omega(\log V)$. This distortion manifests as suboptimal routing paths (stretch $> 1.0$) during coordinate-based greedy routing.

![Greedy routing along a curved geodesic path in the Poincaré disk model. At node u, the neighbor v is selected because it minimizes the hyperbolic coordinate distance d_mathbbH(v, T).](<https://verace.in/research/beyond-dijkstra-shortest-path-routing/figures/figure-2.webp>)

Figure 2: Greedy routing along a curved geodesic path in the Poincaré disk model. At node $u$, the neighbor $v$ is selected because it minimizes the hyperbolic coordinate distance $d_{\mathbb{H}}(v, T)$.

### 2-Hop Cover Labeling

To achieve exact routing (stretch = 1.000) without running a full Dijkstra query, Gavoille et al. (2004) proposed **2-Hop Cover Labeling**. The core idea is that for every node $u \in V$, we precompute a label set $L(u)$ containing pairs of $(h, d_G(u, h))$, where $h$ is a “hub” node and $d_G(u, h)$ is the shortest path distance.

A label set satisfies the 2-hop cover property if for every pair of nodes $S, T \in V$, the shortest path between them contains at least one common hub $h \in L(S) \cap L(T)$. The distance query is then reduced to:

$$
d_G(S, T) = \min_{h \in L(S) \cap L(T)} (d_G(S, h) + d_G(h, T))
$$

By sorting the hub lists, this intersection can be computed in linear time $O(|L(S)| + |L(T)|)$, which is extremely fast in practice when average label sizes are small.

## 3. Methodology

### Hyperbolic Geodesic Coordinate Routing (HGCR)

HGCR maps the graph to the Poincaré Ball model $\mathbb{D}^d = \{ x \in \mathbb{R}^d : \|x\| < 1 \}$. The distance between coordinates $u, v \in \mathbb{D}^d$ is defined as:

$$
d_{\mathbb{H}}(u, v) = \text{arcosh}\left(1 + 2 \frac{\|u - v\|^2}{(1 - \|u\|^2)(1 - \|v\|^2)}\right)
$$

We relax node coordinates by minimizing the edge distance error (stress) using the objective function:

$$
\begin{aligned}
E = \sum_{(u, v) \in E} & \left( d_{\mathbb{H}}(c(u), c(v)) - w(u, v) \right)^2 \\
+ \sum_{\substack{(u,v) \notin E \\ d_{\mathbb{H}} < d_{max}}} & \left( d_{max} - d_{\mathbb{H}}(c(u), c(v)) \right)^2
\end{aligned}
$$

Optimization is performed using **Riemannian Stochastic Gradient Descent (RSGD)**:

$$
c(u) \leftarrow \text{Proj}_{\mathbb{D}^d} \left( c(u) - \eta \frac{(1 - \|c(u)\|^2)^2}{4} \nabla_{\mathbb{R}} E(c(u)) \right)
$$

where $\frac{(1 - \|c(u)\|^2)^2}{4}$ is the conformal factor rescaling the Euclidean gradient $\nabla_{\mathbb{R}}$ to respect the hyperbolic metric tensor.

Query routing starts at $S$ and greedily steps to the neighbor $v \in N(u)$ minimizing $d_{\mathbb{H}}(v, T)$. To prevent local minima, we implement a backtracking stack of size $b$.

### Isometric Hub-Label Routing (IHLR)

IHLR utilizes **Pruned Landmark Labeling (PLL)** to construct $L(u)$ efficiently:

1. Nodes are ordered by decreasing degree centrality to identify key topological transit hubs.
2. For each node $v_i$ in rank order, a Dijkstra search is launched.
3. If the distance to the currently visited node $u$ can already be correctly answered by the existing labels (i.e. $\text{QueryDistance}(v_i, u, L) \le d_G(v_i, u)$), the search branch is **pruned**.
4. Otherwise, the hub pair $(v_i, d_G(v_i, u))$ is appended to $L(u)$, and edge relaxation continues.

At query time, the next hop $v$ from the current node $u$ is chosen by evaluating:

$$
v = \text{argmin}_{w \in N(u)} \left( \text{weight}(u, w) + \text{QueryDistance}(w, T, L) \right)
$$

Since $\text{QueryDistance}$ returns the exact distance, path stretch is guaranteed to be **1.000**.

## 4. Experimental Evaluation

### Setup

We evaluate both paradigms on a 1,000-node connected subgraph extracted via BFS from the New York region road network dataset (`USA-road-d.NY.gr`) of the **9th DIMACS Implementation Challenge**.

- **Graph parameters:** $V = 1,000$, $E = 1,213$ (undirected road segments).
- **HGCR Config:** $\mathbb{D}^5$ space ($d=5$), 500 epochs of RSGD precomputation, learning rate $\eta = 0.015$.
- **IHLR Config:** Node-degree ordering, complete PLL precomputation.

### Benchmark Results

| **Metric** | **Dijkstra** | **HGCR** | **IHLR** |
| --- | --- | --- | --- |
| Path Stretch (Optimality) | 1.000 | 6.015 | **1.000** |
| Avg Query Latency ($\mu$s) | $321.3$ | $1,378.0$ | **$145.7$** |
| Search Space (Edge Checks) | 41,254 | 27,432 | **2,337** |
| Success Rate (%) | 100.0% | 100.0% | **100.0%** |
| Precomputation Time (s) | **0.00s** | 14.50s | **0.076s** |

Table: Table I: Overall Performance Comparison

| **Source $\rightarrow$ Target** | **Dijkstra Time ($\mu$s)** | **IHLR Time ($\mu$s)** | **Dijkstra Ops** | **IHLR Ops** | **Stretch** | **Ops Reduction (%)** | **Status** |
| --- | --- | --- | --- | --- | --- | --- | --- |
| $426 \rightarrow 750$ | 468.4 | 178.5 | 2,059 | 107 | 1.000 | 94.8% | SUCCESS |
| $10 \rightarrow 839$ | 303.3 | 169.6 | 1,317 | 78 | 1.000 | 94.1% | SUCCESS |
| $845 \rightarrow 822$ | 540.9 | 275.1 | 2,258 | 120 | 1.000 | 94.7% | SUCCESS |
| $305 \rightarrow 875$ | 583.1 | 230.9 | 2,343 | 113 | 1.000 | 95.2% | SUCCESS |
| $377 \rightarrow 954$ | 59.9 | 68.4 | 268 | 38 | 1.000 | 85.8% | SUCCESS |
| $198 \rightarrow 276$ | 365.4 | 145.7 | 1,692 | 78 | 1.000 | 95.4% | SUCCESS |
| $579 \rightarrow 446$ | 412.1 | 101.7 | 1,916 | 102 | 1.000 | 94.7% | SUCCESS |
| $165 \rightarrow 382$ | 350.9 | 90.2 | 1,738 | 78 | 1.000 | 95.5% | SUCCESS |
| $127 \rightarrow 895$ | 334.2 | 156.6 | 1,554 | 74 | 1.000 | 95.2% | SUCCESS |
| $178 \rightarrow 626$ | 158.5 | 72.2 | 721 | 38 | 1.000 | 94.7% | SUCCESS |
| $93 \rightarrow 543$ | 78.9 | 52.9 | 366 | 36 | 1.000 | 90.2% | SUCCESS |
| $3 \rightarrow 6$ | 2.4 | 7.5 | 6 | 3 | 1.000 | 50.0% | SUCCESS |

## 5. Discussion & SOTA Trade-off

The empirical results highlight a distinct trade-off between the continuous geometric approach and the discrete algebraic approach:

1. **The Distortion Problem of HGCR:** While HGCR achieves outstanding query latency wins ($1,378\,\mu\text{s}$ vs $16,371\,\mu\text{s}$ in earlier benchmarks), it suffers from a high average path stretch ($6.015$). This is due to metric distortion from mapping cyclical road networks onto a low-dimensional space, forcing packets onto sub-optimal, roundabout paths.
2. **The Domination of IHLR:** IHLR completely outperforms Dijkstra and HGCR in quality. It achieves a **1.000 stretch factor (perfect shortest paths)**, runs **$2.2\times$ faster** than Dijkstra during queries, and cuts graph search space by **94.3%**. Furthermore, its precomputation time (0.076 seconds) is negligible compared to the continuous gradient descent required by HGCR.

## 6. Conclusion

In this paper, we compared continuous hyperbolic embedding and discrete 2-hop cover indexing as replacements for Dijkstra’s shortest path algorithm. Our evaluations on the 9th DIMACS road network benchmark indicate that **Isometric Hub-Label Routing (IHLR)** represents the current state of the art. It resolves the metric distortion associated with continuous coordinate routing, delivering perfectly optimal paths with a $94.3\%$ reduction in graph traversal search space. Future work will focus on scaling IHLR to the full 24-million node contiguous USA graph using parallelized partition algorithms and dynamic incremental label updates.

## References

1. Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik, 1(1), 269-271.
2. Gavoille, C., Peleg, D., Pérennes, S., & Raz, R. (2004). Distance labeling in graphs. Journal of Algorithms, 53(1), 85-112.
3. Akiba, T., Iwata, Y., & Yoshida, Y. (2013). Fast exact shortest-path queries on large networks on query-time pruned labeling. Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data, 349-360.
4. Kleinberg, R. (2007). Geographic routing using hyperbolic space. IEEE INFOCOM 2007-26th IEEE International Conference on Computer Communications, 1902-1909.
5. Bourgain, J. (1985). On Lipschitz embedding of finite metric spaces in Hilbert space. Israel Journal of Mathematics, 52(1-2), 46-52.
6. Demetrescu, C., Goldberg, A. V., & Johnson, D. S. (2009). The Shortest Path Problem: Ninth DIMACS Implementation Challenge. American Mathematical Society.

## License

[PolyForm Noncommercial License 1.0.0](https://verace.in/license)

This work is open research. Free for any noncommercial use: research, education, personal projects, evaluation, and nonprofit or public-sector use. Commercial use requires a separate license, available by contacting krrish@verace.in.
