Efficient Construction of Probabilistic Tree Embeddings
I C A L P
Efficient Construction of Probabilistic Tree Embeddings??
Guy E. Blelloch 0
Yan Gu 0
Yihan Sun 0
0 Carnegie Mellon University , Pittsburgh, PA , USA Carnegie Mellon University , Pittsburgh, PA , USA Carnegie Mellon University , Pittsburgh, PA , USA
In this paper we describe an algorithm that embeds a graph metric (V, dG) on an undirected weighted graph G = (V, E) into a distribution of tree metrics (T, DT ) such that for every pair u, v ? V , dG(u, v) ? dT (u, v) and ET [dT (u, v)] ? O(log n) ? dG(u, v). Such embeddings have proved highly useful in designing fast approximation algorithms, as many hard problems on graphs are easy to solve on tree instances. For a graph with n vertices and m edges, our algorithm runs in O(m log n) time with high probability, which improves the previous upper bound of O(m log3 n) shown by Mendel et al. in 2009. The key component of our algorithm is a new approximate singlesource shortestpath algorithm, which implements the priority queue with a new data structure, the buckettree structure. The algorithm has three properties: it only requires linear time in the number of edges in the input graph; the computed distances have a distance preserving property; and when computing the shortestpaths to the knearest vertices from the source, it only requires to visit these vertices and their edge lists. These properties are essential to guarantee the correctness and the stated time bound. Using this shortestpath algorithm, we show how to generate an intermediate structure, the approximate dominance sequences of the input graph, in O(m log n) time, and further propose a simple yet efficient algorithm to converted this sequence to a tree embedding in O(n log n) time, both with high probability. Combining the three subroutines gives the stated time bound of the algorithm. We also show a new application of probabilistic tree embeddings: they can be used to accelerate the construction of a series of approximate distance oracles.
and phrases Graph Algorithm; Metric Embeddings; Probabilistic Tree Embeddings; Singlesource Shortestpaths

1998 ACM Subject Classification F.2.2 Nonnumerical Algorithms and Problems, G.2.2 Graph
Theory
26:2
1
Introduction
The idea of probabilistic tree embeddings [4] is to embed a finite metric into a distribution
of tree metrics with a minimum expected distance distortion. A distribution D of trees of a
metric space (X, dX ) should minimize the expected stretch ? so that:
1. dominating property: for each tree T ? D, dX (x, y) ? dT (x, y) for every x, y ? X, and
2. expected stretch bound: ET ?D[dT (x, y)] ? ? ? dX (x, y) for every x, y ? X,
where dT (?, ?) is the tree metric, and ET ?D draws a tree T from the distribution D. After a
sequence of results [2, 3, 4], Fakcharoenphol, Rao and Talwar [17] eventually proposed an
elegant and asymptotically optimal algorithm (FRTembedding) with ? = O(log n).
Probabilistic tree embeddings facilitate many applications. They lead to practical
algorithms to solve a number of problems with good approximation bounds, for example, the
kmedian problem, buyatbulk network design [8], and network congestion minimization [30].
A number of network algorithms use tree embeddings as key components, and such
applications include generalized Steiner forest problem, the minimum routing cost spanning tree
problem, and the ksource shortest paths problem [22]. Also, tree embeddings are used in
solving symmetric diagonally dominant (SDD) linear systems. Classic solutions use spanning
trees as the preconditioner, but recent work by Cohen et al. [14] describes a new approach to
use trees with Steiner nodes (e.g. FRT trees).
In this paper we discuss yet another remarkable application of probabilistic tree
embeddings: constructing of approximate distance oracles (ADOs)?a data structure with compact
storage (o(n2)) which can approximately and efficiently answer pairwise distance queries on
a metric space. We show that FRT trees can be used to accelerate the construction of some
ADOs [24, 34, 10].
Motivated by these applications, efficient algorithms to construct tree embeddings are
essential, and there are several results on the topic in recent years [12, 22, 8, 25, 21, 19, 6].
Some of these algorithms are based on different parallel settings, e.g. sharememory setting [8,
19, 6] or distributed setting [22, 21]. As with this paper, most of these algorithms [12, 22,
25, 21, 6] focus on graph metrics, which most of the applications discussed above are based
on. In the sequential setting, i.e. on a RAM model, to the best of our knowledge, the
most efficient algorithm to construct optimal FRTembeddings was proposed by Mendel
and Schwob [25]. It constructs FRTembeddings in O(m log3 n) expected time given an
undirected positively weighted graph with n vertices and m edges. This algorithm, as well
as the original construction in the FRT paper [17], works hierarchically by generating each
level of a tree topdown. However, such a method can be expensive in time and/or coding
complexity. The reason is that the diameter of the graph can be arbitrarily large and the
FRT trees may contain many levels, which requires complicated techniques, such as building
subtrees based on quotient graphs.
Our results. The main contribution of this paper is an efficient construction of the
FRTembeddings. Given an undirected positively weighted graph G = (V, E) with n vertices
and m edges, our algorithm builds an optimal tree embedding in O(m log n) time. In our
algorithm, instead of generating partitions by level, we adopt an alternative view of the FRT
algorithm in [22, 8], which computes the potential ancestors for each vertex using dominance
sequences of a graph (first proposed in [12], and named as leastelement lists in [12, 22]).
The original algorithm to compute the dominance sequences requires O(m log n + n log2 n)
time [12]. We then discuss a new yet simple algorithm to convert the dominance sequences
to an FRT tree only using O(n log n) time. A similar approach was taken by Khan et al. [22]
but their output is an implicit representation (instead of an tree) and under the distributed
setting and it is not workefficient without using the observations and tree representations
introduced by Blelloch et al. in [8].1
Based on the algorithm to efficiently convert the dominance sequences to FRT trees, the
time complexity of FRTembedding construction is bottlenecked by the construction of the
dominance sequences. Our efficient approach contains two subroutines:
An efficient (approximate) singlesource shortestpath algorithm, introduced in Section 3.
The algorithm has three properties: linear complexity, distance preservation, and the
ordering property (full definitions given in Section 3). All three properties are required for
the correctness and efficiency of constructing FRTembedding. Our algorithm is a variant
of Dijkstra?s algorithm with the priority queue implemented by a new data structure
called buckettree structure.
An algorithm to integrate the shortestpath distances into the construction of FRT trees,
discussed in Section 4. When the diameter of the graph is nO(1), we show that an FRT tree
can be built directly using the approximate distances computed by shortestpath algorithm.
The challenge is when the graph diameter is large, and we proposed an algorithm
that computes the approximate dominance sequences of a graph by concatenating the
distances that only use the edges within a relative range of nO(1). Then we show why the
approximate dominance sequences still yield valid FRT trees.
With these new algorithmic subroutines, we show that the time complexity of computing
FRTembedding can be reduced to O(m log n) w.h.p. for an undirected positively weighted
graph with arbitrary edge weight.
In addition to the efficient construction of FRT trees, this paper also discuss a new
application. We show that FRT trees are intrinsically Ramsey partitions (definition given in
Section 5) with asymptotically tight bound, and can achieve even better (constant) bounds
on distance approximation. Previous construction algorithms of optimal Ramsey partitions
are based on hierarchical CKR partitions, namely, on each level, the partition is individually
generated with an independent random radius and new random priorities. In this paper, we
present a new proof to show that the randomness in each level is actually unnecessary, so
that only one single random permutation is enough and the ratio of radii in consecutive levels
can be fixed as 2. Our FRTtree construction algorithm therefore can be directly applied to
a number of different distance oracles that are based on Ramsey partitions and accelerates
the construction of these distance oracles.
2
Preliminaries and Notations
Let G = (V, E) be a weighted graph with edge lengths l : E ? R+, and d(u, v) denote the
shortestpath distance in G between nodes u and v. Throughout this paper, we assume that
minx6=y d(x, y) = 1. Let ? = mmianxxx6=,yy dd((xx,,yy)) = maxx,y d(x, y), the diameter of the graph G.
In this paper, we use the single source shortest paths problem (SSSP) as a subroutine for
a number of algorithms. Consider a weighted graph with n vertices and m edges, Dijkstra?s
algorithm [15] solves the SSSP in O(m + n log n) time if the priority queue of distances is
maintained using a Fibonacci heap [18].
A premetric (X, dX ) defines on a set X and provides a function d : X ? X ? R satisfying
d(x, x) = 0 and d(x, y) ? 0 for x, y ? X. A metric (X, dX ) further requires d(x, y) = 0
iff x = y, symmetry d(x, y) = d(y, x), triangle inequality d(x, y) ? d(x, z) + d(z, y) for
1 A simultaneous work by Friedrichs et al. proposed an O(n log3 n) algorithm of this conversion (Lemma
7.2 in [19]).
x, y, z ? X. The shortestpath distances on a graph is a metric and is called the graph metric
and denoted as dG.
We assume all intermediate results of our algorithm have word size O(log n) and basic
algorithmic operations can be finished within a constant time. Then within the range of
[1, nk], the integer part of natural logarithm of an integer and floor function of an real number
can be computed in constant time for any constant k. This can be achieved using standard
tablelookup techniques (similar approaches can be found in Thorup?s algorithm [32]). The
time complexity of the algorithms are measured using the randomaccess machine (RAM)
model.
A result holds with high probability (w.h.p.) for an input of size n if it holds with
probability at least 1 ? n?c for any constant c > 0, over all possible random choices made by
the algorithm.
Let [n] = {1, 2, ? ? ? , n} where n is a positive integer.
We recall a useful fact about random permutations [31]:
I Lemma 1. Let ? : [n] ? [n] be a permutation selected uniformly at random on [n]. The set
{i  i ? [n], ?(i) = min{?(j)  j = 1, ? ? ? , i}} contains O(log n) elements both in expectation
and with high probability.
3
An Approximate SSSP Algorithm
In this section we introduce a variant of Dijkstra?s algorithm. This is an efficient algorithm
for singlesource shortest paths (SSSP) with linear time complexity O(m). The computed
distances are ?distance preserving:
I Definition 2 (?distance preserving). For a weighted graph G = (V, E), the singlesource
distances d(v) for v ? V from the source node s is ?distance preserving, if there exists a
constant 0 ? ? ? 1 such that ? dG(s, u) ? d(u) ? dG(s, u), and d(v) ? d(u) ? dG(u, v), for
every u, v ? V .
?distance preserving can be viewed as the triangle inequality on singlesource distances (i.e.
d(u) + dG(u, v) ? d(v) for u, v ? V ), and is required in many applications related to distances.
For example, in Corollary 4 we show that using Gabow?s scaling algorithm [20] we can
compute a (1 + )approximate SSSP using O(m log ?1) time. Also in many metric problems
including the contruction of optimal tree embeddings, distance preservation is necessary in
the proof of the expected stretch, and such an example is Lemma 11 in Section 4.3.
The preliminary version we discussed in Section 3.1 limits edge weights in [1, nk] for a
constant k, but with some further analysis in the full version of this paper we can extend
the range to [1, nO(m)]. This new algorithm also has two properties that are needed in the
construction of FRT trees, while no previous algorithms achieve them all:
1. (?distance preserving) The computed distances from the source d(?) is ?distance
preserving.
2. (Ordering property and linear complexity) The vertices are visited in order of distance
d(?), and the time to compute the first k distances is bounded by O(m0) where m0 is the
sum of degrees from these k vertices.
The algorithm also works on directed graphs, although this is not used in the FRT
construction.
Approximate SSSP algorithms are wellstudied [32, 23, 13, 29, 26]. In the sequential
setting, Thorup?s algorithm [32] compute singlesource distances on undirected graphs with
integer weights using O(n + m) time. Nevertheless, Thorup?s algorithm does not obey the
ordering property since it uses a hierarchical bucketing structure and does not visit vertices
in an order of increasing distances, and yet we are unaware of a simple argument to fix this.
Other algorithms are either not workefficient (i.e. superlinear complexity) in sequential
setting, and / or violating distance preservation.
I Theorem 3. For a weighted directed graph G = (V, E) with edge weights between 1 and
nO(1), a (1/4)distance preserving singlesource shortestpath distances d(?) can be computed,
such that the distance to the knearest vertices v1 to vk by d(?)requires O(Pik=1 degree(vi))
time.
The algorithm also has the two following properties. Since they are not used in the
construction of FRT trees, we review them in the full version of this paper. We discuss how
to (1) extend the range of edge weights to nO(m), and the cost to compute the knearest
vertices is O(logn d(vk) + Pik=1 degree(vi)) where v1 to vk are the k nearest vertices; and (2)
compute (1 + )distancepreserving shortestpaths for an arbitrary > 0:
I Corollary 4. (1 + )distancepreserving shortestpaths for all vertices can be computed by
repeatedly using Theorem 3 O(log ?1) times.
3.1
Algorithm Details
The key data structure in this algorithm is a buckettree structure shown in Figure 1 that
implements the priority queue in Dijkstra?s algorithm. With the buckettree structure, each
DecreaseKey or ExtractMin operation takes constant time. Given the edge range
in [1, nk], this structure has l = d(1 + k) log2 ne levels, each level containing a number of
buckets corresponding to the distances to the source node. In the lowest level (level 1) the
difference between two adjacent buckets is 2.
At anytime only one of the buckets in each level can be nonempty: there are in total
l active buckets to hold vertices, one in each level. The active bucket in each level is the
leftmost bucket whose distance is larger than that of the current vertex being visited in
our algorithm. We call these active buckets the frontier of the current distance, and they
can be computed by the path string, which is a 0/1 bit string corresponding to the path
from the current location to higher levels (until the root), and 0 or 1 is decided by whether
the node is the left or the right child of its parent. For clarity, we call the buckets on the
frontier frontier buckets, and the ancestors of the current bucket ancestor buckets (can
be traced using the path string). For example, as the figure shows, if the current distance is
4, then the available buckets in the first several levels are the buckets corresponding to the
distances 6, 5, 11, 7, and so on. The ancestor bucket and the frontier bucket in the same level
may or may not be the same, depending on whether the current bucket is the left or right
subtree of this bucket. For example, the path string for the current bucket with label 4 is
0100 and so on, and ancestor buckets correspond to 4, 5, 3, 7 and so on. It is easy to see that
given the current distance, the path string, the ancestor buckets, and the frontier buckets
can be computed in O(l) time?constant time per level.
Note that since only one bucket in each level is nonempty, the whole structure need
not to be build explicitly: we store one linked list for each level to represent the only active
bucket in the memory (l lists in total), and use the current distance and path string to
retrieve the location of the current bucket in the structure.
With the buckettree structure acting as the priority queue, we can run standard Dijkstra?s
algorithm. The only difference is that, to achieve linear cost for an SSSP query, the operations
of DecreaseKey and ExtractMin need to be redefined on the buckettree structure.
frontier
7
9
11
6
8
10
Ancestor bucket
Frontier bucket
Ancestor/Frontier
bucket
Once the relaxation of an edge succeeds, a DecreaseKey operation for the corresponding
vertex will be applied. In the buckettree structure it is implemented by a Delete (if the
vertex is added before) followed by an Insert on two frontier buckets respectively. The
deletion is trivial with a constant cost, since we can maintain the pointer from each vertex
to its current location in the bucket tree. We mainly discuss how to insert a new tentative
distance into the bucket tree. When vertex u successfully relaxes vertex v with an edge e, we
first round down the edge weight we by computing r = blog2 (we + 1)c. Then we find the
appropriate frontier bucket B that the difference of the distances we0 between this bucket
B and the current bucket is the closest to (but no more than) wr = 2r ? 1, and insert the
relaxed vertex into this bucket. The constant approximation for this insertion operation
holds due to the following lemma:
I Lemma 5. For an edge with length we, the approximated length we0, which is the distance
between the inserted bucket B and the current bucket, satisfies the following inequality:
we/4 ? we0 ? we.
Proof. After the rounding, wr = 2r ? 1 = 2blog2 (we+1)c ? 1 falls into the range of [we/2, we].
We now show that there always exists such a bucket B on the frontier that the approximated
length we0 is in [wr/2, wr].
We use Algorithm 1 to select the appropriate bucket for a certain edge, given the current
bucket level and the path string. The first case is when b, the current level, is larger than r. In
this case all the frontier buckets on the bottom r levels form a left spine of the corresponding
subtree rooted by the right child of the current bucket, so picking bucket in the rth level
leads to we0 = 2r?1, and therefore we/4 < we0 ? we holds. The second case is when b ? r,
and the selected bucket is decided based on the structure on the ancestor buckets from the
(r + 1)th level to (r ? 1)th level, which is one of the three following cases.
The simplest case (b < r, line 9) is when the ancestor bucket in the (r ? 1)th level is the
right child of the bucket in the rth level. In this case when we pick the bucket in level
r since the distance between two consecutive buckets in level r is 2r, and the distance
from the current bucket to the ancestor bucket in rth level is at most Pir=?11 2i?1 < 2r?1.
The distance thus between the current bucket and the frontier bucket in level r is
we0 > 2r ? 2r?1 = 2r?1 > we/4.
The second case is when either b = r and the current bucket is the left child (line 5), or
b < r and the ancestor bucket in level r ? 1 is on the left spine of the subtree rooted at
the ancestor bucket in level r + 1 (line 11). Similar to the first case, picking the frontier
Algorithm 1: Finding the appropriate bucket
Input: Current bucket level b, rounded edge length 2r ? 1 and path string.
Output: The bucket in the frontier (the level is returned).
bucket in the (r + 1)th level (which is also an ancestor bucket) skips the right subtree of
the bucket in rth level, which contains 2r?1 ? 1 ? we/4 nodes.
The last case is the same as the second case expect that the levelr ancestor bucket is the
right child of level(r + 1) ancestor bucket. In this case we will pick the frontier bucket
that has distance 2r?1 to the ancestor bucket in level r, which is the parent of the lowest
ancestor bucket that is a left child and above level r. In this case the approximated edge
distance is between 2r?1 and 2r ? 1.
Combining all these cases proves the lemma. J
We now explain ehe ExtractMin operation on the bucket tree. We will visit vertex
in the current buckets one by one, so each ExtractMin has a constant cost. Once the
traversal is finished, we need to find the next closest nonempty frontier.
I Lemma 6. ExtractMin and DecreaseKey on the bucket tree require O(1) time.
Proof. We have shown that the modification on the linked list for each operation requires
O(1) time. A na?ve implementation to find the bucket in DecreaseKey and ExtractMin
takes O(l) = O(log n) time, by checking all possible frontier buckets. We can accelerate
this lookup using the standard tablelookup technique. The available combinations of the
input of DecreaseKey are nk+1 (total available current distance) by l = O(k log n) (total
available edge distance after rounding), and the input combinations of ExtractMin are two
dlog2 nk+1e bit strings corresponding to the path to the root and the emptiness of the buckets
on the frontier. We therefor partition the bucket tree into several parts, each containing
b(1 ? 0)(log2 n)/2c consecutive levels (for any 0 < 0 < 1). We now precompute the answer
for all possible combinations of path strings and edge lengths, and (1) the sizes of lookup
tables for both operations to be O((2b(1? 0)(log2 n)/2c)2) = o(n), (2) the cost for bruteforce
preprocessing to be O((2b(1? 0)(log2 n)/2c)2 log n) = o(n), and (3) the time of either operation
of DecreaseKey and ExtractMin to be O(k), since each operation requires to look up
at most l/b(1 ? 0)(log2 n)/2c = O(k) tables. Since k is a constant, each of the two operations
as well takes constant time. The update of path string can be computed similarly using this
We now show the three properties of the new algorithm: linear complexity, triangle
inequality, and the ordering property.
Proof of Theorem 3. Here we show the algorithm satisfies the properties in Theorem 3.
Lemma 6 proves the linear cost of the algorithm. Lemma 5 shows that the final distances is
?distance preserving. Lastly, since this algorithm is actually a variant of Dijkstra?s algorithm
with the priority implemented by the buckettree structure, the ordering property is met,
although here the knearest vertices are based on the approximate distances instead of real
distances. J
In the full version we discuss how to extend the range of edge weight to [1, nO(m)].
4
The Dominance Sequence
In this section we review and introduce the notion of dominance sequences for each point
of a metric space and describe the algorithm for constructing them on a graph. The basic
idea of dominance sequences was previously introduced in [12] and [8]. Here we name the
structure as the dominance sequence since the ?dominance? property introduced below is
crucial and related to FRT construction. In the next section we show how they can easily be
converted into an FRT tree.
4.1
Definition
I Definition 7 (Dominance). Given a premetric (X, dX ) and a permutation ?, for two points
x, y ? X, x dominates y if and only if
?(x) = min{?(w)  w ? X, dX (w, y) ? dX (x, y)}.
Namely, x dominates y iff x?s priority is greater (position in the permutation is earlier)
than any point that is closer to y.
The dominance sequence for a point x ? X, is the sequence of all points that dominate x
sorted by distance. More formally:
I Definition 8 (Dominance Sequence2). For each x ? X in a premetric (X, dX ), the dominance
sequence of a point x with respect to a permutation ? : X ? [n] (denoted as ?(?x)), is the
sequence hpiii=1 such that 1 = ?(p1) < ?(p2) < ? ? ? < ?(pk) = ?(x), and pi is in ?(?x) iff pi
k
dominates x.
We use ?? to refer to all dominance sequences for a premetric under permutation ?. It is
not hard to bound the size of the dominance sequence:
I Lemma 9 ([13]). Given a premetric (X, dX ) and a random permutation ?, for each vertex
x ? X, with w.h.p.
?(x) = O(log n)
?
2 Also called as ?leastelement list? in [12]. We rename it since in later sections we also consider many
other variants of it based on the dominance property.
Algorithm 2: Efficient FRT tree construction
1 Pick a uniformly random permutation ? : V ? [n].
2 Compute the dominance sequences ??.
3 Pick ? ? [1, 2] with the probability density function fB(x) = 1/(x ln 2).
4 Convert the dominance sequence ?? to the compressed partition sequence ???,?.
5 Generate the FRT tree based on ???,?.
and hence overall, with w.h.p.
?? = X
x?X
?(x) = O(n log n)
?
Since the proof is fairly straightforward, for completeness we also provide it in the full
version of this paper.
Now consider a graph metric (V, dG) defined by an undirected positively weighted graph
G = (V, E) with n vertices and m edges, and dG(u, v) is the shortest distance between
u and v on G. The dominance sequences of this graph metric can be constructed using
O(m log n + n log2 n) time w.h.p. [12]. This algorithm is based on Dijkstra?s algorithm.
4.2
Efficient FRT tree construction based on the dominance sequences
We now consider the construction of FRT trees based on a precomputed dominance sequences
of a given metric space (X, dX ). We assume the weights are normalized so that 1 ? dX (x, y) ?
? = 2? for all x 6= y, where ? is a positive integer.
The FRT algorithm [17] generates a topdown recursive lowdiameter decomposition
(LDD) of the metric, which preserves the distances up to O(log n) in expectation. It first
chooses a random ? between 1 and 2, and generates 1 + log2 ? levels of partitions of the graph
with radii {??, ??/2, ??/4, ? ? ? }. This procedure produces a laminar family of clusters,
which are connected based on setinclusion to generate the FRT tree. The weight of each
tree edge on level i is ??/2i.
Instead of computing these partitions directly, we adopt the idea of a pointcentric view
proposed in [8]. We use the intermediate data structure ?dominance sequences? as introduced
in Section 4.1 to store the useful information for each point. Then, an FRT tree can be
retrieved from this sequence with very low cost:
I Lemma 10. Given ? and the dominance sequences ?? of a metric space with associated
distances to all elements, an FRT tree can be constructed using O(n log n) time w.h.p.
The difficulty in this process is that, since the FRT tree has O(log ?) levels and ? can be
large (i.e. ? > 2O(n)), an explicit representation of the FRT tree can be very costly. Instead
we generate the compressed version with nodes of degree two removed and their incident
edge weights summed into a new edge. The algorithm is outlined in Algorithm 2.
Proof. We use the definition of partition sequence and compressed partition sequence from [8].
Given a permutation ? and a parameter ?, the partition sequence of a point x ? X, denoted
by ??(x,?) , is the sequence ??(x,?) (i) = min{?(y)  y ? X, d(x, y) ? ? ? 2??i} for i = 0, . . . , ?, i.e.
point y has the highest priority among vertices up to level i. We note that a trie (radix
tree) built on the partition sequence is the FRT tree, but as mentioned we cannot build
this explicitly. The compressed partition sequence, denoted as ???(x,?) , replaces consecutive
8
equal points in the partition sequence ??(x,?) by the pair (pi, li) where pi is the vertex and li is
the highest level pi dominates x in the FRT tree. Figure 2 gives an example of a partition
sequence, a compressed partition sequence, and their relationship to the dominance sequence.
To convert the dominance sequences ?? to the compressed partition sequences ???,? note
that for each point x the points in ???(x,?) are a subsequence of ?(?x). Therefore, for ???(x,?) , we
only keep the highest priority vertex in each level from ?(?x) and tag it with the appropriate
level. Since there are only O(log n) vertices in ?(?x) w.h.p., the time to generate ???(x,?) is
O(log n) w.h.p., and hence the overall construction time is O(n log n) w.h.p.
The compressed FRT tree can be easily generated from the compressed partition sequences
???,? . Blelloch et. al. [8] describe a parallel algorithm that runs in O(n2) time (sufficient for
their purposes) and polylogarithmic depth. Here we describe a similar version to generate
the FRT tree sequentially in O(n log n) time w.h.p. The idea is to maintain the FRT as
a patricia trie [27] (compressed trie) and insert the compressed partition sequences one at
a time. Each insertion just needs to follow the path down the tree until it diverges, and
then either split an edge and create a new node, or create a new child for an existing node.
Note that a hash table is required to trace the tree nodes since the trie has a nonconstant
alphabet. Each insertion takes time at most the sum of the depth of the tree and the length
of the sequence, giving the stated bounds. J
We note that for the same permutation ? and radius parameter ?, it generates exactly
the same tree as the original algorithm in [17].
4.3
Expected Stretch Bound
In Section 4.2 we discussed the algorithm to convert the dominance sequences to a FRT tree.
When the dominance sequences is generated from a graph metric (G, dG), the expected stretch
is O(log n), which is optimal, and the proof is given in many previous papers [17, 8]. Here
we show that any distance function d?G in Lemma 11 is sufficient to preserve this expected
stretch. As a result, we can use the approximate shortestpaths computed in Section 3 to
generate the dominance sequences and further convert to optimal tree embeddings.
I Lemma 11. Given a graph metric (G, dG) and a distance function d?G(u, v) such that for
u, v, w ? V , d?G(u, v) ? d?G(u, w) ? 1/? ? dG(v, w) and dG(u, v) ? d?G(u, v) ? 1/? ? dG(u, v)
for some constant 0 < ? ? 1, then the dominance sequences based on (G, d?G) can still yield
optimal tree embeddings.
Proof Outline. Since the overestimate distances hold the dominating property of the tree
embeddings, we show the expected stretch is also not affected. We now show the expected
stretch is also held.
Recall the proof of the expected stretch by Blelloch et al. in [8] (Lemma 3.4). By replacing
dG by d?G, the rest of the proof remains unchanged except for Claim 3.5, which upper bounds
the expected cost of a common ancestor w of u, v ? V in u and v?s dominance sequences. The
original claim indicates that the probability that u and v diverges in a certain level centered
at vertex w is O(dG(w, u) ? dG(w, v)/dG(u, w)) = O(dG(u, v)/dG(u, w)) and the penalty is
O(dG(u, w)), and therefore the contribution of the expected stretch caused by w is the product
of the two, which is O(dG(u, v)) (since there are at most O(log n) of such w (Lemma 9), the
expected stretch is thus O(log n)). With the distance function d?G and ? as a constant, the
probability now becomes O(d?G(w, u) ? d?G(w, v)/d?G(u, w)) = O(dG(u, v)/dG(u, w)), and
the penalty is O(d?G(u, w)) = O(dG(u, w)). As a result, the expected stretch asymptotically
remains unchanged. J
4.4
Efficient construction of approximate dominance sequences
Assume that d?G(u, v) is computed as du(v) by the shortestpath algorithm in Section 3
from the source node u. Notice that du(v) does not necessarily to be the same as dv(u), so
(G, d?G(u, v)) is not a metric space. Since the computed distances are distance preserving, it
is easy to check that Lemma 11 is satisfied, which indicate that we can generate optimal tree
embeddings based on the distances. This leads to the main theorem of this paper.
I Theorem 12 (Efficient optimal tree embeddings). There is a randomized algorithm that
takes an undirected positively weighted graph G = (V, E) containing n = V  vertices and
m = E edges, and produces an tree embedding such that for all u, v ? V , dG(u, v) ? dT (u, v)
and E[dT (u, v)] ? O(log n) ? dG(u, v). The algorithm w.h.p. runs in O(m log n) time.
The algorithm computes approximate dominance sequences ??? by the approximate SSSP
algorithm introduced in Section 3. Then we apply Lemma 10 to convert ??? to an tree
embedding. Notice that this tree embedding is an FRTembedding based on d?G. We still call
this an FRTembedding since the overall framework to generate hierarchical tree structure is
similar to that in the original paper [17].
The advantage of our new SSSP algorithm is that the DecreaseKey and
ExtractMin operation only takes constant time when the relative edge range (maximum divided by
minimum) is no more than nO(1). To handle arbitrary weight edges we adopt a similar idea
to [23] to solve the subproblems on specific edge ranges, and concatenate the results to form
the final output. This requires preprocessing to restrict the edge range.
The highlevel idea of the algorithm is as follows. In the preprocessing, the goal is to use
O(m log n) time to generate a list of subproblems: the ith subproblem has edge range in the
interval [ni?1, ni+1] and we compute the elements in the dominance sequences with values
falling into the range from ni to ni+1. All the edge weights less than the minimum value of
this range are treated as 0. Namely, the vertices form some components in one subproblem
and the vertex distances within each component is 0.
After the subproblems are computed, we run the shortestpath algorithm on each
subproblem, and the ith subproblem generates the entries in the approximate dominance sequences
in the range of [ni, ni+1). Finally, we solve an extra subproblem that only contains edges
with weight less than n to generate the elements in dominance sequences whose distances
fall in range [1, n).
Due to page limit, the details of the algorithm, the proofs of the correctness and time
bound are given in the full version of this paper.
5
An Application of FRTEmbedding: Ramsey Partitions and
Distance Oracles
In this section we show a new application of FRTembedding, which with our efficient
construction, accelerates the construction of some existing approximate distance oracles [34,
10]. The bridge is to show that the FRT trees are Ramsey partitions [24]. It is interesting to
point out that, the construction of FRT trees is not only much faster and simpler than the
previous bestknown approach [25] to generate Ramsey partitions, but the stretch factor of
k, which is 18.5, is also smaller than the previous constants of 128 [24] and 33 [28].
We start with the definition of Ramsey partitions. Let (X, dX ) be a metric space. A
hierarchical partition tree of X is a sequence of partitions {Pk}k?=0 of X such that P0 = {X},
the diameter of the partitions in each level decreases by a constant c > 1, and each level
Pk+1 is a refinement of the previous level Pk. A Ramsey partition [24] is a distribution of
hierarchical partition trees such that each vertex has a lowerbounded probability of being
sufficiently far from the partition boundaries in all partitions k, and this gap is called the
padded range of a vertex. More formally:
I Definition 13. An (?, ?)Ramsey partition of a metric space (X, dX ) is a probability
distribution over hierarchical partition trees P of X such that for every x ? X:
Pr ?k ? N, BX x, ? ? c?k?
? Pk(x) ? X?? .
An asymptotically tight construction of Ramsey partition where ? = ?(?) is provided by
Mendel and Naor [24] using the CalinescuKarloffRabani partition [9] for each level.
I Theorem 14. The probability distribution over FRT trees is an asymptotically tight Ramsey
Partition with ? = ?(?) (shown in the appendix) with fixed c = 2. More precisely, for every
x ? X,
Prh?i ? N, BX x, 1 ? 2?1/2a 2?i?
? Pi(x)i ? 21 X? a2
for any positive integer a > 1.
The details of the proof are provided in the full version of this paper.
Ramsey Partitions are used in generating approximate distance oracles (ADOs), which
supports efficient approximate pairwise shortestdistance queries. ADOs are wellstudied by
many researchers (e.g. [33, 5, 1, 16, 11, 24, 34, 10]), and a (P, S, Q, D)distance oracle on a
finite metric space (X, dX ) is a data structure that takes expected time P to preprocess from
the given metric space, uses S storage space, and answers distance query between points x
and y in X in time Q satisfying dX (x, y) ? dO(x, y) ? D ? dX (x, y), where dO(x, y) is the
pairwise distance provided by the distance oracle, and D is called the stretch.
I Corollary 15. With Theorem 14, we can accelerate the time to construct the
Ramseypartitionsbased Approximate Distance Oracle in [24] to
O n1/k(m + n log n) log n
on a graph with n vertices and m edges, improving the stretch to 18.5k, while maintaining
the same storage space and constant query time.
This can be achieved by replacing the original hierarchical partition trees in the distance
oracles by FRT trees (and some other trivial changes). The construction time can further
reduce to O n1/km log n using the algorithm introduced in Section 4.4 while the oracle still
has a constant stretch factor. Accordingly, the complexity to construct Christian
WulffNilsen?s Distance Oracles [34] and Shiri Chechik?s Distance Oracles [10] can be reduced
to
O kmn1/k + kn1+1/k log n + n1/ckm log n
since they all use Mendel and Naor?s Distance Oracle to obtain an initial distance estimation.
The acceleration is from two places: first, the FRT tree construction is faster; second, FRT
trees provide better approximation bound, so the c in the exponent becomes smaller.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Rachit Agarwal and Philip Godfrey . Distance oracles for stretch less than 2 . In Proceedings of ACMSIAM Symposium on Discrete Algorithms (SODA) , pages 526  538 , 2013 .
Noga Alon , Richard M. Karp, David Peleg, and Douglas West . A graphtheoretic game and its application to the kserver problem . SIAM Journal on Computing , 24 ( 1 ): 78  100 , 1995 .
In Proceedings of IEEE Foundations of Computer Science (FOCS) , pages 184  193 , 1996 .
Yair Bartal . On approximating arbitrary metrices by tree metrics . In Proceedings of ACM Symposium on Theory of Computing (STOC) , pages 161  168 . ACM, 1998 .
Surender Baswana and Telikepalli Kavitha . Faster algorithms for approximate distance oracles and allpairs small stretch paths . In Proceedings of IEEE Symposium on Foundations of Computer Science (FOCS) , pages 591  602 , 2006 .
Guy E. Blelloch , Yan Gu, Julian Shun, and Yihan Sun . Parallelism in randomized incremental algorithms . In Proceedings of ACM Symposium on Parallelism in Algorithms and Architectures (SPAA) , pages 467  478 , 2016 .
Guy E. Blelloch , Yan Gu, and Yihan Sun . Efficient construction of probabilistic tree embeddings . arXiv preprint arXiv:1605.04651 , 2016 . URL: https://arxiv.org/abs/1605.
Guy E. Blelloch , Anupam Gupta, and Kanat Tangwongsan . Parallel probabilistic tree embeddings, kmedian, and buyatbulk network design . In Proceedings of ACM symposium on Parallelism in Algorithms and Architectures (SPAA) , pages 205  213 , 2012 .
Gruia Calinescu , Howard Karloff, and Yuval Rabani . Approximation algorithms for the 0extension problem . SIAM Journal on Computing , 34 ( 2 ): 358  372 , 2005 .
Shiri Chechik . Approximate distance oracles with constant query time . In Proceedings of ACM Symposium on Theory of Computing (STOC) , pages 654  663 , 2014 .
Shiri Chechik . Approximate distance oracles with improved bounds . In Proceedings of ACM on Symposium on Theory of Computing (STOC) , pages 1  10 , 2015 .
Edith Cohen . Sizeestimation framework with applications to transitive closure and reachability . Journal of Computer and System Sciences , 55 ( 3 ): 441  453 , 1997 .
Edith Cohen . Polylogtime and nearlinear work approximation scheme for undirected shortest paths . Journal of the ACM (JACM) , 47 ( 1 ): 132  166 , 2000 .
Michael B. Cohen , Rasmus Kyng, Gary L. Miller , Jakub W. Pachocki, Richard Peng, Anup B. Rao , and Shen Chen Xu. Solving SDD linear systems in nearly m log1/2 n time .
In Proceedings of ACM Symposium on Theory of Computing (STOC) , pages 343  352 , 2014 .
Edsger W. Dijkstra . A note on two problems in connexion with graphs . Numerische mathematik , 1 ( 1 ): 269  271 , 1959 .
Michael Elkin and Seth Pettie . A linearsize logarithmic stretch pathreporting distance oracle for general graphs . In Proceedings of ACMSIAM Symposium on Discrete Algorithms (SODA) , pages 805  821 , 2015 .
Jittat Fakcharoenphol , Satish Rao , and Kunal Talwar . A tight bound on approximating arbitrary metrics by tree metrics . Journal of Computer and System Sciences (JCSS) , 69 ( 3 ): 485  497 , 2004 .
Michael L. Fredman and Robert Endre Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms . Journal of the ACM (JACM) , 34 ( 3 ): 596  615 , 1987 .
Stephan Friedrichs and Christoph Lenzen . Parallel Metric Tree Embedding Based on an Algebraic View on MooreBellmanFord. In Proceedings of ACM Symposium on Parallelism in Algorithms and Architectures (SPAA) , pages 455  466 , 2016 .
Harold N. Gabow . Scaling algorithms for network problems . Journal of Computer and System Sciences , 31 ( 2 ): 148  168 , 1985 .
Mohsen Ghaffari and Christoph Lenzen . Nearoptimal distributed tree embedding . In International Symposium on Distributed Computing , pages 197  211 . Springer, 2014 .
Maleq Khan , Fabian Kuhn, Dahlia Malkhi, Gopal Pandurangan, and Kunal Talwar . Efficient distributed approximation algorithms via probabilistic tree embeddings . Distributed Computing , 25 ( 3 ): 189  205 , 2012 .
Philip N. Klein and Sairam Subramanian . A randomized parallel algorithm for singlesource shortest paths . Journal of Algorithms , 25 ( 2 ): 205  220 , 1997 .
Manor Mendel and Assaf Naor . Ramsey partitions and proximity data structures . In Proceedings of IEEE Symposium on Foundations of Computer Science (FOCS) , pages 109  118 , 2006 .
Manor Mendel and Chaya Schwob. Fast CKR partitions of sparse graphs. Chicago Journal of Theoretical Computer Science , pages 1  18 , 2009 . Article 2. doi: 10 .4086/cjtcs. 2009 .
Gary L. Miller , Richard Peng, Adrian Vladu, and Shen Chen Xu. Improved parallel algorithms for spanners and hopsets . In Proceedings of ACM Symposium on Parallelism in Algorithms and Architectures (SPAA) , pages 192  201 , 2015 .
Donald R. Morrison . PATRICIA  Practical Algorithm To Retrieve Information Coded in Alphanumeric. Journal of the ACM (JACM) , 15 ( 4 ): 514  534 , October 1968 .
Assaf Naor and Terence Tao . Scaleoblivious metric fragmentation and the nonlinear Dvoretzky theorem . Israel Journal of Mathematics , 192 ( 1 ): 489  504 , 2012 .
Seth Pettie and Vijaya Ramachandran . A shortest path algorithm for realweighted undirected graphs . SIAM J. Comput. , 34 ( 6 ): 1398  1431 , 2005 .
Harald R?cke . Optimal hierarchical decompositions for congestion minimization in networks . In Proceedings of ACM Symposium on Theory of Computing (STOC) , pages 255  264 , 2008 .
Raimund Seidel . Backwards analysis of randomized geometric algorithms . Springer, 1993 .
Mikkel Thorup . Undirected single source shortest paths in linear time . In Proceedings of IEEE Symposium on Foundations of Computer Science (FOCS) , pages 12  21 , 1997 .
Mikkel Thorup and Uri Zwick . Approximate distance oracles . Journal of the ACM (JACM) , 52 ( 1 ): 1  24 , 2005 .
Christian WulffNilsen . Approximate distance oracles with improved query time . In Proceedings of ACMSIAM Symposium on Discrete Algorithms (SODA) , pages 539  549 , 2013 .