Abstract
Sampling is a standard approach in big-graph analytics; the goal is to efficiently estimate the graph properties by consulting a sample of the whole population. A perfect sample is assumed to mirror every property of the whole population. Unfortunately, such a perfect sample is hard to collect in complex populations such as graphs (e.g. web graphs, social networks), where an underlying network connects the units of the population. Therefore, a good sample will be representative in the sense that graph properties of interest can be estimated with a known degree of accuracy. While previous work focused particularly on sampling schemes to estimate certain graph properties (e.g. triangle count), much less is known for the case when we need to estimate various graph properties with the same sampling scheme. In this paper, we propose a generic stream sampling framework for big-graph analytics, called Graph Sample and Hold (gSH), which samples from massive graphs sequentially in a single pass, one edge at a time, while maintaining a small state in memory. We use a Horvitz-Thompson construction in conjunction with a scheme that samples arriving edges without adjacencies to previously sampled edges with probability $p$ and holds edges with adjacencies with probability $q$. Our sample and hold framework facilitates the accurate estimation of subgraph patterns by enabling the dependence of the sampling process to vary based on previous history. Within our framework, we show how to produce statistically unbiased estimators for various graph properties from the sample. Given that the graph analytics will run on a sample instead of the whole population, the runtime complexity is kept under control. Moreover, given that the estimators are unbiased, the approximation error is also kept under control. Finally, we test the performance of the proposed framework (gSH) on various types of graphs, showing that from a sample with ~40K edges, it produces estimates with relative errors < 1%.
The Challenge of Big-Graph Analytics
As graphs grow to billions of nodes and edges, traditional "brute-force" analytics become computationally impossible or prohibitively expensive. Researchers often turn to sampling to get an "approximate" answer, but most existing sampling methods are either designed for static graphs (requiring multiple passes) or are specialized for a single metric, such as counting triangles.
The challenge is creating a generic, one-pass streaming framework that can estimate multiple graph properties simultaneously while maintaining a small memory footprint. Furthermore, many sampling methods introduce "bias"—a systematic error where the estimate is consistently higher or lower than the truth. This paper introduces a way to provide unbiased estimators, meaning that on average, the sampling results will center exactly on the true value of the full graph.
The Graph Sample and Hold (gSH) Framework
The authors introduce Graph Sample and Hold (gSH), inspired by a technique from computer networking used to track high-volume traffic flows. The algorithm processes a stream of edges one by one using a logic that balances exploration and exploitation.
Dual Probabilities and "Hold" Logic
When a new edge $k$ arrives, the algorithm evaluates its relationship to the current sample $\widehat{K}$:
- Triangle Completion: If $k$ would complete a triangle in $\widehat{K}$, it is sampled with probability $r = 1$.
- Adjacency (The "Hold"): If $k$ is adjacent to any edge already in the sample (sharing a node), it is sampled with probability $r = q$.
- Exploration: If there is no match, the edge is sampled with a lower probability $r = p$.
To turn this sample back into a global estimate, the authors use the Horvitz-Thompson construction. Essentially, every sampled object (like a triangle) is weighted by the inverse of the probability that it was selected. If a triangle had a 1-in-1000 chance of being sampled, it counts as 1000 triangles in the final estimate. Uniquely, the framework includes formulas to estimate the accuracy (variance) of its own results using only the sampled data, allowing researchers to calculate confidence intervals on the fly.
Experimental Evaluation
The authors evaluated gSH on two distinct types of networks to ensure robustness:
- Social Facebook Graphs: Datasets from CMU, UCLA, and Wisconsin, which are typically dense with many local connections.
- Web Graphs: Hyperlink networks from Stanford, Google, and BerkStan, which are generally sparser.
The datasets ranged from 250,000 to 6.6 million edges, providing a rigorous test for big-data performance.
Key Results and Performance
The framework demonstrated exceptional accuracy and efficiency across all tested graph topologies.
- High Accuracy: For most graphs, the relative error for edge counts, triangle counts, and clustering coefficients was less than 1%, even when sampling only a tiny fraction of the total graph. For example, on the Wisconsin social graph, the relative error for edge counts was as low as 0.03%.
- Massive Speedups: On the "web-BerkStan" graph, calculating properties on the full graph took 113.9 seconds. Using gSH with a sample of ~40k edges, it took only 1.05 seconds—a 100x speedup.
- Superiority over State-of-the-Art: When compared to the "Streaming-Triangles" algorithm (Jha et al., 2013), gSH produced errors that were orders of magnitude smaller while often requiring less storage. On the Stanford web graph, Jha et al. had a 7% error, while gSH achieved 0.23% error with a smaller sample size.
Conclusion and Future Work
gSH provides a powerful, generic utility for graph analytics. Unlike previous techniques hard-coded for one task, gSH can estimate links, triangles, paths of length two, and global clustering coefficients all from the same sampled edge set. While highly effective, future work aims to extend the framework to more complex structures like 4-cliques or specific motifs and explore the nuances of directed edge streams in more detail.
Summary updated