On Sampling Edges Almost Uniformly

Talya Eden, Will Rosenbaum

TL;DR

This paper provides the first sublinear-time algorithm to sample an edge from a graph "almost uniformly" using only basic queries (vertex, degree, and neighbor). The authors prove that their algorithm’s query complexity of $\tilde{O}(n/\sqrt{\epsilon m})$ is mathematically optimal, establishing a fundamental limit on how quickly we can explore massive, unknown networks.

What Problem Does This Paper Address?

In the era of massive data, we often deal with graphs (like social networks or the web) that are too large to store or traverse entirely. Sublinear algorithms aim to solve problems by looking at only a tiny fraction of the data.

A fundamental building block for many graph algorithms is edge sampling: picking a single edge $(u, v)$ from the set of all edges $E$ such that every edge has an equal (uniform) probability of being chosen. While sampling a random vertex is usually easy, sampling an edge is hard because we don't know the graph's structure. If you simply pick a random vertex and then one of its neighbors, you bias your sample toward edges connected to high-degree "hub" nodes.

The authors set out to find an algorithm that samples edges "almost uniformly" (within a small error $\epsilon$) while making as few queries as possible to the graph.

Methods

The authors introduce an algorithm called Sample-edge-almost-uniformly. The core strategy relies on partitioning the graph's complexity into two manageable parts based on a degree threshold $\theta \approx \sqrt{m/\epsilon}$:

  1. Light Edges: These originate from "light" vertices (degree $\le \theta$). To sample these, the algorithm picks a vertex at random. If it's light, it picks a random "slot" out of $\theta$ possible neighbors. Because $\theta$ is an upper bound, this query might fail, but when it succeeds, every light edge has an equal $1/(n\theta)$ chance of being picked.
  2. Heavy Edges: These originate from "heavy" vertices (degree $> \theta$). Sampling these is trickier because heavy vertices are rare but have many edges. The algorithm uses a clever two-step process: it first samples a light edge $(u, v)$. If $v$ happens to be a heavy vertex, it then samples a random neighbor $w$ of $v$ to return the edge $(v, w)$.

By running these two procedures with equal probability, the algorithm balances the bias. The authors also utilize an existing algorithm (Goldreich & Ron) to estimate the total number of edges $m$, which is necessary to set the threshold $\theta$ correctly.

Datasets

As a theoretical computer science paper, this work does not use empirical datasets or training sets. Instead, the results are proven mathematically for any arbitrary undirected graph $G = (V, E)$. To prove the lower bound (the "optimality"), the authors construct a specific adversarial graph consisting of a hidden clique to show that no algorithm can do better than their proposed complexity.

Key Insights and Ideas

  • The "Pointwise" Guarantee: Most sampling algorithms aim for "Total Variational Distance" (an aggregate measure of error). This paper achieves a much stronger "pointwise $\epsilon$-close" guarantee, meaning every single edge is guaranteed to be sampled with a probability very close to $1/m$. This is crucial for applications like estimating the weight of specific subgraphs.
  • Overcoming the Hub Bias: The "aha moment" is the realization that heavy vertices (the hubs) have many light neighbors. By "arriving" at a heavy vertex via a light edge, the algorithm can sample the heavy vertex's edges without needing to know where all the heavy vertices are located.
  • The Power of Neighbor Queries: The paper highlights that while vertex and degree queries are helpful, the ability to query the "$i$-th neighbor" is what makes sublinear edge sampling possible.

Key Results

  • Upper Bound: The proposed algorithm returns an edge in $\tilde{O}(n/\sqrt{\epsilon m})$ expected queries. For a graph with $n$ vertices and $m$ edges, this is significantly faster than looking at the whole graph when the graph is relatively sparse.
  • Lower Bound: The authors prove that any algorithm providing an almost-uniform sample must perform at least $\Omega(n/\sqrt{m})$ queries. This means their algorithm is optimal up to logarithmic factors and the error parameter $\epsilon$.
  • Weighted Sampling: Because of the strong pointwise guarantee, the authors show their algorithm can be used to estimate the average of any function $w: E \to \mathbb{R}$ (weighted edges) with high precision.

Limitations and Future Work

  • Almost vs. Exactly Uniform: The authors acknowledge that while they achieved "almost" uniform sampling, it remains an open question whether exactly uniform sampling is possible in sublinear time.
  • Topology Dependence: The current algorithm's performance is independent of the graph's topology. However, for specific types of graphs (like those that "mix" quickly in a random walk), other methods might be faster. The authors suggest that exploring the trade-offs between different query types (like "pair queries") for specific graph families is a promising next step.
  • Knowledge of $m$: The algorithm requires an estimate of the total number of edges. While they show how to get this estimate, it adds a layer of complexity to the implementation.

Summary updated

BibTeX
@inproceedings{eden2018sampling,
  author = {Talya Eden and Will Rosenbaum},
  title = {{On Sampling Edges Almost Uniformly}},
  booktitle = {SOSA},
  year = {2018},
  doi = {10.4230/oasics.sosa.2018.7},
}
Figure