NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Efficient Streaming Algorithms for Graphlet Sampling

Yann Bourreau, Marco Bressan, T-h. Hubert Chan, Qipeng Kuang, Mauro SozioNeurIPS 2024

Graphlets—small, connected induced subgraphs—are the fundamental "motifs" or building blocks of complex networks. Sampling them uniformly at random is a critical step in graph machine learning, enabling the creation of feature vectors for tasks like graph classification, subgraph identification, and clustered federated learning. However, as real-world graphs scale to billions of edges, they no longer fit into the main memory (RAM) of a single machine.

The current state-of-the-art algorithm, Uniform Graphlet Sampler (UGS), operates efficiently in a standard RAM model but fails in "Big Data" scenarios. UGS relies on a specific topological ordering of vertices generated by repeatedly deleting the vertex with the maximum degree. In a streaming context, where edges can only be read in sequential passes, this inherently sequential process would require a prohibitive $O(n)$ passes.

The STREAM-UGS Solution

To bridge this gap, the authors introduce STREAM-UGS, the first efficient semi-streaming algorithm for sampling $k$-vertex graphlets uniformly at random. Operating in the semi-streaming model—where available memory $M$ is proportional to the number of vertices $n$ ($M = \Omega(n \log n)$) but much smaller than the number of edges $m$—STREAM-UGS achieves near-optimal trade-offs between memory usage and the number of data passes.

The algorithm is divided into two primary phases:

  1. Preprocessing via APPROX-DD: To bypass the $O(n)$-pass bottleneck of UGS, STREAM-UGS computes an approximate $\vartheta$-degree-dominating order in just $O(\log n)$ passes. It employs a "peeling" and "shaving" strategy: in each round, high-degree vertices are identified and randomly partitioned, allowing them to be removed in large batches without violating the necessary degree properties.
  2. Parallel Sampling: Once the approximate order is established, the algorithm grows graphlets from starting vertices. It uses a single-pass routine to filter out "empty buckets" (vertices incapable of forming a $k$-graphlet) and runs multiple sampling trials in parallel. By utilizing clever data structures to share the edge stream across these parallel trials, the time complexity is drastically reduced from $O(m \cdot \text{Trials})$ to $O(m \log \text{Trials})$.

Key Insights and Techniques

  • Approximation over Perfection: The authors demonstrate that a perfect maximum-degree-deletion order is unnecessary for uniform sampling. An approximate order—where a vertex's degree is within a constant factor of its successors—is sufficient, provided the final acceptance probability is appropriately adjusted.
  • Near-Optimality: The paper establishes a theoretical lower bound, proving that any $p$-pass streaming algorithm for this problem requires $\Omega(n/p)$ bits of memory. STREAM-UGS operates very close to this theoretical limit.
  • Parallel Independence: Despite sharing the same edge stream across parallel sampling trials, the algorithm successfully maintains the statistical independence of the samples, ensuring a truly uniform graphlet distribution.

Empirical Results and Scalability

STREAM-UGS was evaluated on massive real-world graphs from the KONECT repository, including the NY Times, Twitter (WWW & MPI), and the massive Friendster network (containing ~68 million vertices and 1.8 billion edges), as well as a synthetic dense graph.

The algorithm successfully processed the 1.8-billion-edge Friendster graph in approximately 30 passes. Preprocessing requires $O(\log n)$ passes, while a batch of $\Theta(M k^{-O(k)})$ graphlets can be sampled in $O(k)$ passes. Crucially, unlike previous methods like MOTIVO where memory requirements explode as $k$ increases, STREAM-UGS's memory usage is independent of the graphlet size $k$. Furthermore, unlike "color-coding" methods that might miss certain subgraphs, STREAM-UGS guarantees truly uniform samples from the entire set of connected induced subgraphs.

Limitations and Future Directions

While highly efficient, STREAM-UGS is bound by the semi-streaming constraint, requiring $\Omega(n \log n)$ memory to store vertex-related data. For hyper-scale graphs where even the vertex set exceeds memory limits, further adaptations are necessary. Additionally, while the pass complexity is polylogarithmic, constant factors in time and memory bounds can be significant in practice.

The authors suggest that the foundational techniques introduced here pave the way for uniform graphlet sampling in other distributed frameworks, such as MapReduce, potentially unlocking even larger-scale graph analysis in the future.

Summary updated

BibTeX
@inproceedings{bourreau2024efficient,
  author = {Yann Bourreau and Marco Bressan and T-H. Hubert Chan and Qipeng Kuang and Mauro Sozio},
  title = {{Efficient Streaming Algorithms for Graphlet Sampling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=EC9Hfi9V3k},
}
Figure