Jump to content

Distance oracle

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Erel Segal (talk | contribs) at 13:02, 4 February 2015 (Approximate distance oracle). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, a distance oracle is a data structure for calculating distances between vertices in a graph.

Introduction

Let G(V,E) be an undirected, weighted graph, with n=|V| nodes and m=|E| edges. We would like to answer queries of the form "what is the distance between the nodes s and t?".

One way to do this is just run the Dijkstra algorithm. This takes time , and requires no extra space (besides the graph itself).

In order to answer many queries more efficiently, we can spend some time in pre-processing the graph and creating an auxiliary data structure.

A simple data structure that achieves this goal is a matrix which specifies, for each pair of nodes, the distance between them. This structure allows us to answer queries in constant time , but requires extra space. It can be initialized in time using an all-pairs shortest paths algorithm, such as the Floyd–Warshall algorithm.

A distance oracle lies between these two extremes. It uses less than space in order to answer queries in less than time. Most distance oracles have to compromise on accuracy, i.e. they don't return the accurate distance but rather a constant-factor approximation of it.


Approximate distance oracle

[1] describe more than 10 different distance oracles. They then suggest a new distance oracle that, for every k, requires space , such that any subsequent distance query can be approximately answered in time . The approximate distance returned is of stretch at most , that is, the quotient obtained by dividing the estimated distance by the actual distance lies between 1 and . The initialization time is .

Some special cases include:

  • For we get the simple distance matrix.
  • For we get a structure using space which answers each query in constant time and approximation factor at most 3.
  • For , we get a structure using space, query time , and stretch .

Higher values of k do not improve the space or preprocessing time.

Oracle for general metric spaces

The oracle is built of a decreasing collection of k+1 sets of vertices:

  • For every : contains each element of , independently, with probability . Note that the expected size of is . The elements of are called i-centers.

For every node v, we calculate its distance from each of these sets:

  • For every : and . I.e., is the i-center nearest to v, and is the distance between them. Note that for a fixed v, this distance is weakly increasing with i. Also note that for every v, .
  • .

For every v, compute its bunch:

The bunch of v contains all vertices in which are strictly closer to v than all vertices in . It is possible to show that the expected size of is at most .

For every bunch , construct a hash table that holds, for every , the distance .

The total size of the data structure is


Having this structure initialized, the following algorithm finds the distance between two nodes, u and v:

  • while :
  • return

Improvements

Their result was improved by [2] who suggest a distance oracle of size which returns a factor 2 approximation.

References

  1. ^ Attention: This template ({{cite doi}}) is deprecated. To cite the publication identified by doi:10.1145/1044731.1044732, please use {{cite journal}} (if it was published in a bona fide academic journal, otherwise {{cite report}} with |doi=10.1145/1044731.1044732 instead.
  2. ^ Attention: This template ({{cite doi}}) is deprecated. To cite the publication identified by doi:10.1109/FOCS.2010.83, please use {{cite journal}} (if it was published in a bona fide academic journal, otherwise {{cite report}} with |doi=10.1109/FOCS.2010.83 instead.