Chapter 3 Distance Oracles With Linear Space
3.1 Contributions and Techniques
This chapter makes three contributions. First, we show a space-time trade-off for all even stretch values greater than 3. The result is as follows:
Theorem 1. Let G be a weighted undirected graph with n vertices, m edges with
non-negative edge weights and average degreeµ = 2m/n. For any 1≤ α ≤ n and for any integer k≥ 2, there exists a distance oracle of size eOm + nα + n2/αk
that returns stretch-2k distances in time O(αµ). The query time can be reduced
Using the same space as that of Thorup-Zwick oracle, our oracles reduce the stretch from 2k + 1 to 2k using query time O(n1/(k+1)). For instance, in dense graphs, retrieving distances of stretch 5 and 7 requires space Θ(n4/3) and Θ(n5/4) respectively [41]; queries require constant time, and larger time cannot help reduce space or stretch. For the realistic case of graphs with
m = eO(n)edges, special cases of our oracles from Theorem 1 yield schemes for retrieving stretch 4 distances using space eO(n4/3), and stretch 6 distances using space eO(n5/4), at the expense of eO(n1/3) and eO(n1/4) query time, respectively.
Furthermore, the query time can be reduced at the expense of larger space, providing a space-time trade-off for any even stretch k≥ 4.
Our second contribution is an extremely simple construction of constant- time stretch-2k oracles for any positive integer k:
Theorem 2. Let G be a weighted undirected graph with n vertices and m edges
with non-negative edge weights. For any integer k ≥ 2, there exists a distance oracle of size eOm1−2k+12 n
4 2k+1
that returns stretch-2k distances in O(k) time. For instance, the above theorem shows the existence of constant-time stretch- 4 and stretch-6 oracles of size eO(n4/5m3/5) and eO(n4/7m5/7), respectively. The above theorem generalizes and simplifies the result of [75], who constructed similar oracles but using significantly more complicated techniques. Our tech- nique, on the other hand, is extremely simple and is a natural generalization of the techniques used for the result of Theorem 1.
The oracles of Theorem 1 and of Theorem 2 can return paths corresponding to stretch-2k distance estimate in constant-time per hop. In many applications, however, distance computations suffice and shortest paths are not desired. For such applications, we show the existence of distance oracles with significantly better space-time trade-off for certain stretch values. These oracles allow us to compute constant stretch distances using space linear in the size of the input graph. The result is precisely summarized in the following theorem:
Theorem 3. Let G be a weighted undirected graph with n vertices, m edges with
non-negative edge weights and average degreeµ = 2m/n. For any 1≤ α ≤ n and for any integer k≥ 2, there exists a distance oracle of size eOm + (n/α)1+1/k
that returns stretch-(4k− 1) distances in time O(αµ). The query time can be
reduced to O(α) using an additional eO(mα) space.
For instance, for graphs with m = eO(n) edges, our last oracle is a stretch-3 oracle of size eO(n)that answers each distance query in time O(pn).
Table 3.1: Summary of distance oracles presented in this chapter. Here,
µ = 2m/n is the average degree of the graph, k≥ 1 is a constant and
1≤ α ≤ n is a parameter providing trade-off between space and query time. Stretch Space Query time Construction time
2k Oe m + nα + n 2 αk O(αµ) O(ne 2) 2k Oe mα + n 2 αk O(α) O(ne 2+ mα) 2k Oem1−2k+12 n 4 2k+1 O(k) O(me 1−2k+12 n 4 2k+1) 4k− 1 Oem + (n/α)1+1k O(αµ) O(mn/α)e 4k− 1 eOmα + (n/α)1+1k O(α) O(mn/α)e
A summary of our distance oracles from Theorem 1, Theorem 2 and The- orem 3 is presented in Table 3.1. Figure 3.1 provides a visual understanding of the space-time trade-off for small values of k for the special case of graphs with m = eO(n) edges. We complement our theoretical results with extensive simulations on synthetic and real-world networks; our results suggest that our oracles not only improve the worst-case stretch of Thorup-Zwick oracles but significantly improve the average-case stretch as well. In particular, we show that our oracles are able to retrieve the exact shortest path for most source- destination pairs.
Techniques. Our stretch-2k oracles of Theorem 1 are conceptually similar to the stretch-(2k + 1) oracles of Thorup and Zwick (TZ) [41] (see §2.4.1) with the difference that our construction is parameterized with a parameter α that provides the space-time trade-off in our oracle. That is, rather than sampling each vertex with probability 1/n1/k for inclusion in set L as in TZ oracles, our oracle samples each vertex with probability 1/α. Our main contribution here is a query algorithm that reduces the stretch from 2k + 1 to 2k.
0 0.1 0.2 0.3 0.4 0.5 0.6 1 1.1 1.2 1.3 1.4 1.5 1.6
Query Time Exponent
Space Exponent stretch=3 stretch=4 stretch=6 stretch=7
Figure 3.1: Space-time trade-off of oracles in Table 3.1 for graphs with
m = eO(n)edges. The space and the query time exponents are defined as logn(S) and logn(T ), where S is the size and T is the query time of the oracle.
Recall from §2.4.1, that when queried for the distance between a pair of vertices s and t, TZ oracle returns a distance estimate of (2k + 1)· d(s, t). A closer examination of the stretch proof reveals that the distance returned by the oracle is precisely (2k− 1) · d(s, t) + 2 · d(s, ℓ(s)); since d(s, ℓ(s)) ≤ d(s, t), we get that the returned distance is indeed of stretch 2k + 1. Intuitively, the cases that attain worst-case stretch in their oracle are the ones for which the destination t is just outside the ball of the source s (that is, d(s, ℓ(s))≈ d(s, t)). For such source-destination pairs, we exploit the idea of ball-vicinity intersec-
tion— upon receiving a query, we search for vertices in B⋆(s)∩ B(t). Finding such vertices takes some time; but among all vertices w ∈ B⋆(s)∩ B(t), the least-cost path s w t is a candidate stretch-2k path. We show that if this candidate path is not a stretch-2k path (in fact, we show something stronger — if this path is not the shortest path between s and t), the vertices s and
t must be relatively distant, giving us a lower bound of 2· d(s, ℓ(s)) on the exact distance between s and t. Using this lower bound, we get that the dis- tance returned by the TZ-oracle is in fact (2k− 1) · d(s, t) + 2 · d(s, ℓ(s)) ≤ (2k− 1) · d(s, t) + d(s, t) = 2k · d(s, t), as desired.
To further reduce the space for stretch 3 oracle, our last oracle stores the exact distances only between all pairs of landmarks. This uses significantly less space; for instance, in a graph with n nodes, storing shortest distances between every pair of n/α landmarks requires only O(n2/α2) space. We are,
this scheme can be generalized to achieve reduced space at the expense of increased stretch: rather than storing shortest paths between landmarks, we approximate these distances using TZ oracles [41].
Related Work. A detailed comparison of our results with previously known upper bounds on distance oracles for general graphs is presented in Table 3.2. Independent of our work, Abraham and Gavoille [80] constructed constant- time stretch (2k, 1) oracles for the special case of unweighted graphs; our constant-time oracles generalize their construction to weighted graphs. Table 3.2: Upper bounds for distance oracles for general undirected graphs. The (α, β ) in column 3 denotes multiplicative α and additive β stretch.
µ = 2m/n denotes the average degree of the graph. Distance oracles with
additive stretch are for unweighted graphs.
Reference Space Stretch Query Time
[41] O(n3/2) 3 O(1)
§3.5, [48] O(m + n2/α2) 3 O(αµ)
§3.5, Unpublished O(mα + n2/α2) 3 O(α)
[41] O(kn1+1/k) 2k− 1 O(k)
§3.5, [48] O(m + (n/α)(1+1/k)) 4k− 1 O(αµ)
§3.5, [48] O(mα + (n/α)(1+1/k)) 4k− 1 O(α)
§3.3, Unpublished O(m + nα + n2/αk) 2k O(αµ)
§3.3, Unpublished O(mα + n2/αk) 2k O(α)
§3.4, Unpublished O(m1−2k+12 n 4 2k+1) 2k O(k) [76] O(n5/3) (2, 1) O(1) [80] O(n1+2k+12 ) (2k, 1) O(1) [48] O(nα + n2/α) (2, 1) O(α) [48] O(nα + (n/α)(1+1/k)) (4k− 1, 2k) O(α)