Average Distance Queries through Weighted Samples in Graphs and Metric Spaces: High Scalability with Tight Statistical Guarantees

Shiri Chechik, Edith Cohen, Haim Kaplan

Introduction

In the analysis of large-scale networks and metric spaces, the "average distance" from a specific point to all other points is a fundamental metric. It serves as the mathematical foundation for closeness centrality—a measure of how central a node is within a social or communication network—and the 1-median problem, which is essential for identifying optimal cluster centers in geometric data. However, as datasets scale into the millions or billions of nodes, traditional exact methods for calculating these distances become computationally prohibitive.

The Scalability Bottleneck

The primary challenge in computing average distances for every node in a graph is its relationship to the All-Pairs Shortest Paths (APSP) problem. To obtain exact values for all $n$ nodes, one typically requires $O(n^3)$ time (or slightly better with advanced algorithms), which is infeasible for modern massive graphs.

While researchers have historically turned to uniform sampling to estimate these values, this approach is often unreliable. In many real-world datasets, distance distributions exhibit "heavy tails"—where a small number of extremely distant points significantly influence the average. Uniform sampling frequently misses these outliers, leading to high variance and inaccurate estimates.

The Universal Weighted Sampling Framework

This paper introduces a novel weighted sampling scheme based on Probability Proportional to Size (PPS). The authors' primary innovation is the development of "universal" sampling coefficients.

In traditional weighted sampling, estimating the average distance from node $A$ would require a sample set specifically tailored to $A$'s distance distribution. Estimating for node $B$ would require another. The authors prove that a single, carefully constructed set of sampling probabilities can provide accurate, unbiased estimates for every node in the graph simultaneously.

Algorithmic Approach

The methodology is divided into two primary phases:

  1. Sample Construction (Algorithm 1): The algorithm computes universal coefficients by performing a limited number of single-source shortest path (SSSP) computations from a small "base set" of nodes. This base set is selected to represent "well-positioned" nodes—those whose median distance is relatively close to the global minimum median distance.
  2. Estimation (Algorithm 2): Once the weighted sample $S$ is established, the distance from any query point $v$ to the entire set $V$ is estimated by summing the distances from $v$ to the sampled points, scaled by the inverse of their respective sampling probabilities.

Theoretical Significance and Key Insights

The paper provides several rigorous proofs that elevate the proposed method over previous state-of-the-art techniques:

  • Optimal Sample Complexity: Previous methods required $O(\epsilon^{-3})$ samples to achieve a relative error of $\epsilon$. This work achieves the $O(\epsilon^{-2})$ mark, which is widely considered the theoretical optimum for sampling-based estimators.
  • Independence of Scale: For a fixed error tolerance $\epsilon$, the sample size required to estimate a node's average distance is independent of the total number of points $n$. This property ensures that the method remains efficient regardless of the growth of the underlying dataset.
  • Subcubic Equivalence: The authors establish a formal link between the "All-Pairs Sum" problem and APSP. They prove that the two are subcubic equivalent, implying that any significant breakthrough in exact distance summation would likely solve one of the most enduring problems in computer science. This reinforces the necessity of estimation and sampling for large-scale applications.
  • High Probability Guarantees: By slightly increasing the sample size to $O(\epsilon^{-2} \log n)$, the algorithm guarantees that the maximum relative error across all nodes remains below $\epsilon$ with high probability.

Conclusion

This research provides a robust theoretical framework for scaling distance-based queries. By moving from uniform to universal weighted sampling, the authors achieve tight statistical guarantees with significantly fewer computations. While the current work focuses on undirected graphs and metric spaces, the authors note that directed graphs require strong connectivity and "round trip" distances for these results to hold. Future extensions may explore adaptive sampling techniques to further optimize performance in real-world implementations. The discovery that $O(\epsilon^{-2})$ SSSP computations suffice for all-nodes estimation marks a significant milestone in the study of graph algorithms and big data analytics.

Summary updated

BibTeX
@inproceedings{chechik2015average,
  author = {Shiri Chechik and Edith Cohen and Haim Kaplan},
  title = {{Average Distance Queries through Weighted Samples in Graphs and Metric Spaces: High Scalability with Tight Statistical Guarantees}},
  booktitle = {APPROX-RANDOM},
  year = {2015},
  url = {https://openreview.net/forum?id=AfEzh_Of3f},
}
Figure