REPT: A Streaming Algorithm of Approximating Global and Local Triangle Counts in Parallel

Pinghui Wang, Peng Jia, Yiyan Qi, Yu Sun, Jing Tao, Xiaohong Guan

TL;DR

REPT (Random Edge Partition and Triangle counting) is a novel parallel streaming algorithm that accurately estimates global and local triangle counts in massive graphs. By using a clever edge-partitioning strategy instead of independent sampling, it effectively eliminates the estimation errors caused by the "covariance" between triangles, making it several times more accurate than simply parallelizing existing state-of-the-art methods.

What Problem Does This Paper Address?

In network science, triangles (sets of three nodes where every pair is connected) are fundamental building blocks used for everything from detecting spam accounts to identifying community structures. As real-world graphs (like Twitter or phone call networks) grow to billions of edges, we can no longer count these triangles exactly in a single pass.

Existing "streaming" algorithms like MASCOT and Triest use random sampling to estimate these counts. However, they were designed for single-core environments. When researchers try to speed them up by running multiple independent trials in parallel and averaging the results, they hit a wall: high variance.

The authors identify that this variance is dominated by the "covariance" between triangles that share an edge. In many real-world graphs, the number of such pairs ($\eta$) is orders of magnitude larger than the actual number of triangles ($\tau$). Simple parallelization fails to reduce this specific type of error efficiently.

Methods

The authors introduce REPT, which moves away from independent sampling in favor of a coordinated parallel approach.

  1. Random Edge Partitioning: Instead of each processor sampling edges independently, REPT uses a hash function $h(u,v)$ to distribute edges of the stream $\Pi$ across $c$ processors.
  2. Covariance Elimination: The mathematical "magic" happens here. By partitioning edges such that each edge is assigned to exactly one processor (when the number of processors $c$ is less than or equal to the inverse of the sampling probability $1/p$), the authors theoretically prove they can significantly reduce or even completely eliminate the error term introduced by the covariance of sampled triangles.
  3. Optimal Combination ($c > m$): When more processors are available than needed for a single partition, REPT divides them into groups. Each group produces an independent estimate, and these are combined using a variance-weighted average to produce the most accurate final result.
  4. One-Pass Streaming: Like its predecessors, REPT processes edges one by one and doesn't require the full graph to be stored in memory, making it suitable for high-speed data streams.

Datasets

The researchers evaluated REPT on eight diverse, large-scale real-world graph datasets:

  • Social/Communication Networks: Twitter (1.2 billion edges), com-Orkut, LiveJournal, Pokec, Flickr, and Wiki-Talk.
  • Web/Link Graphs: Web-Google and YouTube.

These datasets were chosen because they represent different structural properties, specifically varying ratios of triangles to edge-sharing triangle pairs.

Key Insights and Ideas

  • The "Aha" Moment on Covariance: The paper's biggest contribution is recognizing that the bottleneck for parallel accuracy isn't just the sample size, but the dependency between triangles. If two triangles share an edge, their appearances in a sample are correlated.
  • Partitioning > Independent Sampling: While independent sampling is the "standard" way to parallelize, REPT shows that coordinated partitioning via hashing is superior because it allows the mathematical cancellation of the covariance term in the variance formula.
  • Efficiency vs. Accuracy: REPT manages to be significantly more accurate than parallel MASCOT while maintaining almost the same computational overhead per edge.

Key Results

  • Superior Accuracy: On the Twitter dataset ($p=0.01, c=320$), REPT's estimation error (NRMSE) was 8.6 times smaller than parallelized MASCOT and Triest, and 25.7 times smaller than GPS (another state-of-the-art method).
  • Speedups: REPT is 2 to 4 times faster than parallel Triest and 4 to 10 times faster than GPS. It achieves this because it avoids the complex reservoir sampling or weight calculations those methods require.
  • Local vs. Global: The accuracy gains held true for both global triangle counts (the whole graph) and local counts (triangles incident to specific nodes).

Limitations and Future Work

  • Static Graph Limitation: The authors acknowledge that if a graph is static and already stored in a specific format (like an adjacency list) on a disk, other non-streaming parallel algorithms (like PATRIC) might be more accurate. REPT is specifically optimized for streams of edges.
  • Future Directions: The current implementation is focused on multi-core machines. The authors plan to extend REPT to fully distributed platforms (like clusters using MapReduce or Spark) to handle even larger datasets.

Summary updated

BibTeX
@inproceedings{wang2019rept,
  author = {Pinghui Wang and Peng Jia and Yiyan Qi and Yu Sun and Jing Tao and Xiaohong Guan},
  title = {{REPT: A Streaming Algorithm of Approximating Global and Local Triangle Counts in Parallel}},
  booktitle = {ICDE},
  year = {2019},
  url = {https://openreview.net/forum?id=l8oN5Jdj5m},
}
Figure