TL;DR
Sampling a random edge from a massive graph without loading the whole thing into memory is surprisingly hard. This paper shows that while sampling a single edge has a known lower bound, we can achieve a significant "bulk discount" by using a preprocessing step to sample multiple edges in $O^*(\sqrt{q} \cdot (n/\sqrt{m}))$ time—a square-root speedup over the naive approach of repeating a single-edge sampler $q$ times.
What Problem Does This Paper Address?
In sublinear algorithms, we often deal with graphs so large that we cannot afford to look at every edge. Instead, we use a "query model" (specifically the adjacency list model), where we can ask for a random vertex, the degree of a vertex, or the $i$-th neighbor of a vertex.
The fundamental challenge is edge sampling: how do you pick an edge uniformly at random if you don't know where they are? If a graph is very sparse (few edges) but has a few "star" vertices with massive degrees, a random vertex query will likely miss the edges. Previous work established that sampling a single edge requires $\Theta^*(n/\sqrt{m})$ queries.
The authors tackle a practical follow-up: If an algorithm (like one for counting triangles or subgraphs) needs $q$ different edge samples, do we have to pay that high cost $q$ times? Or can we do some "homework" (preprocessing) to make subsequent samples cheaper?
Methods
The authors propose a two-phase approach: Preprocessing and Sampling.
1. The Light/Heavy Split
The core idea is to partition vertices into "light" (low degree) and "heavy" (high degree) based on a threshold $\tau$.
- Light edges (incident to light vertices) are easy to sample: pick a random vertex; if it's light, pick a random neighbor. Because the degree is capped by $\tau$, the "success rate" is manageable.
- Heavy edges are the "needles in the haystack."
2. Preprocessing (The "Aha!" Moment)
Instead of trying to find heavy vertices from scratch every time, the preprocessing phase samples a small, random set of vertices $S$. Because heavy vertices have many neighbors, they are likely to be "hit" by the neighbors of this random set $S$. The algorithm builds a data structure that allows it to sample edges incident to $S$ very quickly.
3. Amortized Sampling
When a sample is requested, the algorithm flips a coin to decide whether to try sampling a light edge or a heavy edge (using the pre-built data structure). By adjusting the threshold $\tau$ based on the number of samples $q$ expected, they balance the one-time cost of preprocessing against the per-sample cost.
4. Pointwise $\epsilon$-closeness
The authors ensure the distribution is pointwise $\epsilon$-close to uniform. This is a strict requirement: it means every single edge must be picked with a probability within a $(1 \pm \epsilon)$ factor of $1/m$. This is much stronger than Total Variation Distance (TVD), which allows the algorithm to completely ignore a small fraction of "difficult" edges.
Datasets
This is a theoretical paper focused on computational complexity and algorithmic proofs. Consequently, no empirical datasets were used for evaluation. The results are proven mathematically to hold for any general undirected graph.
Key Insights and Ideas
- Decoupling the Threshold: In single-edge sampling, the threshold between light and heavy vertices is forced to be high to ensure you can find something quickly. By allowing preprocessing, the authors "decouple" this, letting the threshold be much lower, which makes the per-sample phase extremely fast.
- The Power of Pointwise: The paper provides a great intuition for why pointwise closeness matters. If you use a sampler that is only close in TVD, it might completely miss a tiny clique (like a single triangle) in a massive bipartite graph. If your goal is to count triangles, a TVD sampler would fail miserably, while a pointwise sampler would succeed.
- Optimal Trade-offs: The authors provide a "knob" (the parameter $x$) that allows a user to trade off more preprocessing for faster sampling, proving that the optimal setting for $q$ samples leads to the $\sqrt{q}$ complexity.
Key Results
- Improved Complexity: For $q$ samples, the total query complexity is $O^*(\sqrt{q} \cdot (n/\sqrt{m}))$.
- Comparison: If you need $q = \sqrt{n}$ samples in a graph where $m = n$, the old way took $O(n)$ queries. This new algorithm takes only $O(n^{3/4})$ queries.
- Lower Bound Match: The authors note that subsequent work by Tětek and Thorup proved that this $\sqrt{q}$ dependency is essentially the best anyone can ever do in this model.
Limitations and Future Work
- Knowing $q$ in Advance: The current algorithm requires an estimate of how many samples ($q$) will be needed to set the optimal threshold $\tau$. While one could potentially adapt this "on the fly," it isn't explicitly handled here.
- Graph Dynamics: The model assumes a static graph. If the graph changes (edges added/removed), the preprocessing data structure would likely need significant updates.
- Bounded Arboricity: The authors mention that for specific types of graphs (like those with bounded arboricity), there might be even more efficient ways to sample multiple edges, which remains an interesting open question.
Summary updated