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

Triangle Counting in Hypergraph Streams: A Complete and Practical Approach

Lingkai Meng, Long Yuan, Xuemin Lin, Wenjie Zhang, Ying Zhang · DOI

Introduction

In modern data science, many complex systems are better represented as hypergraphs rather than traditional graphs. While a standard graph edge connects exactly two vertices, a hyperedge can connect any number of vertices, making it an ideal model for group-based interactions such as co-authorship networks, multi-item retail transactions, or group communications.

As these networks grow and evolve in real-time, analyzing their structure through streaming data is essential. A fundamental metric in this analysis is triangle counting—identifying interconnected groups of three vertices. However, existing streaming algorithms for hypergraphs suffer from two critical flaws: they rely on incomplete structural models and utilize memory inefficiently. This paper introduces a complete taxonomy of hypergraph triangles and two novel, memory-aware sampling algorithms, HTCount and HTCount-P, to address these challenges.

The Problem: Incomplete Models and Inflexible Memory

Existing research into hypergraph triangles has largely focused on two extremes: "Inner" triangles (where all three vertices reside in a single hyperedge) and "Outer" triangles (where three vertices are pairwise connected across three distinct hyperedges). This binary view ignores intermediate structures that are vital for understanding network evolution.

Furthermore, streaming algorithms must operate under strict memory constraints. Previous methods typically sampled a fixed number of hyperedges. Because hyperedge sizes vary wildly—ranging from a two-author paper to a physics collaboration with hundreds of contributors—a fixed-edge budget often leads to two poor outcomes: either the algorithm exceeds the memory limit and crashes, or it underutilizes memory, resulting in significant estimation errors.

A Complete Taxonomy of Hypergraph Triangles

To provide a more granular analysis, the authors propose a complete taxonomy that includes a previously overlooked category:

  1. Inner Triangles: Three vertices contained within a single hyperedge.
  2. Outer Triangles: Three vertices connected pairwise through three different hyperedges.
  3. Hybrid Triangles: Three vertices contained within one hyperedge, where two of those vertices also share a second, separate hyperedge.

In real-world datasets like academic co-authorship networks, these hybrid triangles are not just theoretical outliers; they often dominate the network structure. Tracking them can provide early warning signals for phenomena like interdisciplinary convergence, where sub-teams begin collaborating before full integration occurs.

Proposed Algorithms: HTCount and HTCount-P

The authors developed two algorithms designed to maximize accuracy by focusing on actual memory consumption (vertex count) rather than edge count.

HTCount (Memory-Aware Reservoir Sampling)

HTCount implements a reservoir sampling strategy that caps the total number of vertices stored ($M$). As new hyperedges arrive in the stream, the algorithm decides whether to include them in the sample. If a new, large hyperedge exceeds the remaining memory, HTCount randomly evicts existing edges until the new data fits. Mathematical correction factors are then applied to ensure the final triangle count remains an unbiased estimate.

HTCount-P (Partition-based Sampling)

While HTCount is effective, it can suffer from memory fragmentation. If a massive hyperedge is evicted and replaced by a much smaller one, a portion of the memory budget may sit idle. HTCount-P solves this by monitoring memory utilization. If utilization drops below a threshold, it partitions the unused memory into a new, independent sampling subset. Incoming edges are routed to these subsets probabilistically, ensuring the memory budget is always fully utilized without introducing statistical bias.

Experimental Results

The algorithms were evaluated against eight real-world datasets, including academic networks (MAG, DBLP), retail data (Walmart), and legislative data (Congress-bills).

  • Accuracy: Both HTCount and HTCount-P achieved relative errors 10x to 100x lower than the current state-of-the-art baseline (HyperSV). By utilizing the full memory budget, the algorithms significantly reduced the variance of their estimates.
  • Memory Utilization: HTCount-P maintained near 100% memory utilization across all datasets. In contrast, fixed-edge methods often utilized less than 5% of available memory to avoid potential crashes, severely limiting their performance.
  • Throughput: Despite the mathematical complexity of tracking varying edge sizes and intersections, the algorithms maintained high throughput, processing hundreds to thousands of KB per second. This demonstrates their practicality for high-velocity, one-pass data streams.

Conclusion and Future Work

By redefining the taxonomy of hypergraph triangles and shifting the focus from edge-based to memory-based sampling, this research provides a more accurate and robust framework for real-time hypergraph analysis. The discovery that hybrid triangles are a dominant feature in real-world networks opens new avenues for studying network evolution.

Future work includes extending this framework to count higher-order motifs (such as 4-vertex cliques) and developing distributed implementations to handle billion-scale hypergraph streams across multiple machines. The authors also plan to apply this complete triangle taxonomy to improve other downstream tasks, such as hypergraph clustering and core decomposition.

Summary updated

BibTeX
@article{meng2025triangle,
  author = {Lingkai Meng and Long Yuan and Xuemin Lin and Wenjie Zhang and Ying Zhang},
  title = {{Triangle Counting in Hypergraph Streams: A Complete and Practical Approach}},
  journal = {Proc. ACM Manag. Data},
  year = {2025},
  doi = {10.1145/3769837},
}
Figure