Abstract
As graph data grows in velocity and scale, traditional analysis tools struggle to keep pace. We present Graph Priority Sampling (GPS), a novel framework for reservoir sampling from massive graph streams. By employing a priority-based weighting system and a Martingale-based estimation framework, GPS enables accurate estimation of subgraph counts, such as triangles, while maintaining a sub-linear memory footprint. Experimental results on massive real-world graphs demonstrate that GPS can achieve less than 1% error while storing only a tiny fraction of the total edges.
Introduction
In the modern "data deluge," social networks, IoT devices, and communication logs generate graph data at rates that exceed storage and processing capacities. Analyzing these "open-ended" streams requires algorithms that operate with a minimal memory footprint and provide high estimation accuracy for global graph properties. Existing sampling methods often suffer from high variance or are specialized for specific properties, limiting their general utility.
The Graph Priority Sampling (GPS) Framework
The core contribution of this work is the Graph Priority Sampling (GPS) framework. GPS generalizes reservoir sampling by introducing a priority-based selection mechanism.
Priority-Based Reservoir
For every arriving edge $k$, the algorithm assigns a weight $w(k)$ and a random variable $u(k) \sim \text{Uni}(0, 1)$. The edge's priority is defined as $r(k) = w(k)/u(k)$. The reservoir maintains a fixed size $m$, keeping only the edges with the highest priorities. This weighting scheme is flexible; for instance, edges that complete triangles in the current sample can be weighted more heavily to improve specific subgraph estimates.
Unbiased Estimation
A significant theoretical advancement of GPS is the use of Martingale theory to prove that its estimators are unbiased. Despite the dependencies introduced by a fixed-size reservoir, the Martingale-based framework ensures that the expected value of the estimates matches the true global counts. GPS supports two estimation modes: "Post-Stream" for retrospective queries and "In-Stream" for real-time updates, the latter of which significantly reduces variance by processing edges before they are potentially discarded.
Experimental Evaluation
The researchers evaluated GPS using 50 real-world graphs from the Network Repository, including massive social networks like Twitter (260M edges) and Orkut (117M edges), as well as web and infrastructure graphs.
Accuracy and Performance
GPS demonstrates remarkable efficiency. On the Twitter dataset, it estimated triangle counts with less than 1% error while storing only 40,000 edges (approximately 0.015% of the total). The update time per edge is in the order of microseconds, making it suitable for high-velocity streams.
As shown in the figure above, the ratio of estimated to true counts ($\hat{x}/x$) for both triangles and wedges remains tightly clustered around 1.0 across diverse datasets, confirming the robustness and consistency of the GPS framework.
Conclusion and Future Work
GPS effectively decouples edge sampling from subgraph estimation, allowing a single sample to serve multiple query types. Its topology-aware weighting and in-stream estimation provide a significant leap over state-of-the-art methods like TRIEST and MASCOT, often yielding a 10x improvement in accuracy.
Future research directions include developing adaptive weighting schemes that automatically tune parameters based on stream characteristics and extending the framework to handle dynamic streams with edge deletions.
Summary updated