Triangle Counting in Dynamic Graph Streams

Laurent Bulteau, Vincent Froese, Konstantin Kutzkov, Rasmus Pagh · DOI

TL;DR

This paper introduces a novel algorithm for estimating the number of triangles in dynamic graph streams where edges can be both inserted and deleted. By uniquely combining graph sparsification with post-stream 2-path sampling, the algorithm achieves superior space and time complexity, including the first constant ($O(1)$) per-edge processing time for graphs with a constant transitivity coefficient.

What Problem Does This Paper Address?

Counting triangles in graphs is a fundamental task in network analysis, essential for calculating clustering coefficients, detecting communities, and uncovering structural properties in social networks, biology, and web graphs. However, modern networks are massive and must often be processed in a streaming model with strictly limited memory.

While previous research successfully tackled "insert-only" streams, real-world networks are highly dynamic—edges are constantly added and removed (e.g., friending and unfriending on Facebook). Existing dynamic streaming algorithms suffer from high processing times per edge or large memory footprints because edge deletions can invalidate previously sampled subgraphs. This paper addresses the challenge of designing a triangle-counting algorithm for dynamic streams that matches the efficiency of insert-only alternatives.

Methods

The authors propose a clever hybrid approach that merges monochromatic graph sparsification with 2-path sampling:

  1. Sparsification during the stream: Vertices are randomly colored using a hash function. An edge is kept in a sparsified graph ($G_S$) if and only if its endpoints share the same color. Because edges are evaluated independently based on vertex color, deletions are handled naturally.
  2. Estimation of total 2-paths: In parallel, the algorithm uses a standard streaming black box to estimate the second frequency moment ($F_2$) of the vertex degrees, which yields an estimate of the total number of 2-paths ($P_2$) in the original graph.
  3. Sampling after the stream: Once the stream is fully processed, the algorithm samples 2-paths uniformly at random from the sparsified graph $G_S$ and checks how many form triangles to estimate the transitivity coefficient ($\alpha$).

The core technical achievement is proving that sampling from this sparsified graph provides an almost unbiased estimate of the original graph's transitivity, despite the potential statistical biases introduced by sparsification.

Datasets

The paper evaluates the theoretical performance guarantees of their algorithm using structural parameters from 12 real-world graph datasets from the Stanford Large Network Dataset Collection (SNAP). These include:

  • Social & Communication Networks: Enron, Facebook, LiveJournal, Youtube
  • Co-authorship & Citation Networks: Astro-Ph, Cond-Mat, DBLP
  • Autonomous Systems & Routers: AS20000102, Oregon, Skitter
  • Other: roadNet-CA (California road network), Amazon (product co-purchasing)

Key Insights and Ideas

  • Sparsify First, Sample Later: Standard sampling fails in dynamic streams because you cannot predict if a sampled edge will be deleted later. By sparsifying the entire stream uniformly and delaying the 2-path sampling until the end, deletions are cleanly handled.
  • The Power of Constant Transitivity: In many real-world networks, the transitivity coefficient $\alpha$ (the ratio of triangles to 2-paths) behaves like a constant. The authors exploit this property to achieve $O(1)$ update time per edge, a massive practical win for high-frequency streams.
  • Combinatorial Guarantee: To bound the sampling probability, the authors prove a new graph-theoretic lower bound: any connected graph with $m$ edges contains at least $\lfloor m/18 \rfloor$ pairwise independent 2-paths.

Key Results

  • Complexity Bounds: The algorithm achieves a space complexity of $O(\frac{\sqrt{m}}{\epsilon^3 \alpha} \log \frac{1}{\delta})$ and an update time of $O(\frac{1}{\epsilon^2 \alpha} \log \frac{1}{\delta})$ per edge. As shown in Table 1, this significantly improves upon previous dynamic streaming algorithms by Ahn et al. and Manjunath et al. for various graph classes.
Table 1: Overview of time and space bounds.
  • Zipfian Distributions: For graphs with power-law degree distributions (parameterized by $z$), the paper demonstrates superior time and space bounds across different ranges of $z$ (see Tables 2 and 3).
Table 2: Comparison of the theoretical guarantees for the per edge processing time for varying z.
Table 3: Comparison of the theoretical guarantees for the space usage for varying z.
  • Hardness Lower Bound: The authors prove a space lower bound of $\Omega(m^3 / T_3^2)$ bits for any single-pass algorithm that distinguishes between triangle-free graphs and those with at least $T_3$ triangles without making structural assumptions, proving that their bounds match optimal limits for general graphs.

Limitations and Future Work

  • Structural Dependence: The algorithm's efficiency relies heavily on the graph's transitivity coefficient $\alpha$. If a graph has an extremely small number of triangles relative to 2-paths (low $\alpha$), the space and time complexities degrade.
  • Future Directions: The authors suggest extending these sampling and sparsification techniques to count more complex graph structures (like larger cliques or graph minors) in dynamic streams. They also note the need for tighter space lower bounds tailored specifically to the structural properties of real-world graphs rather than worst-case general graphs.

Summary updated

BibTeX
@article{bulteau2016triangle,
  author = {Laurent Bulteau and Vincent Froese and Konstantin Kutzkov and Rasmus Pagh},
  title = {{Triangle Counting in Dynamic Graph Streams}},
  journal = {Algorithmica},
  year = {2016},
  doi = {10.1007/s00453-015-0036-4},
}
Figure