DeMEtRIS: Counting (near)-Cliques by Crawling

Suman K. Bera, Jayesh Choudhari, Shahrzad Haddadan, Sara Ahmadian · DOI

TL;DR

Counting dense structures like cliques in massive networks is incredibly difficult when you can only access the network by crawling it vertex by vertex. This paper introduces DeMEtRIS, the first algorithm with provably sub-linear query complexity for counting cliques and near-cliques using random walks. By combining hierarchical sampling with a new combinatorial framework for dense motifs, DeMEtRIS achieves under 5% estimation error while exploring only a tiny fraction of the graph.

What Problem Does This Paper Address?

Subgraph counting (or motif counting) is a foundational task in network analysis, cyber security, and bioinformatics. For example, finding cliques (groups of nodes where everyone connects to everyone else) helps identify tightly-knit communities or functional protein complexes.

However, most classic algorithms assume you can see the entire graph at once or sample vertices uniformly at random. In the real world, massive networks like Facebook or Twitter restrict access via public APIs. You cannot download the whole graph; you can only "crawl" it by querying a specific user's friends list. This is formalized as the random walk access model.

In this restricted setting, counting complex structures is notorious for causing massive variance: some edges belong to zero cliques, while others belong to millions. Standard sampling techniques either require querying the entire graph or suffer from terrible accuracy. The authors tackle the challenge of accurately estimating these global counts while looking at only a tiny fraction of the network.

Methods

The authors introduce DeMEtRIS (Dense Motif Estimation through Random Incident Sampling). Instead of trying to find full cliques all at once, DeMEtRIS uses a technique called hierarchical sampling adapted for random walks:

  1. Base Layer Selection: The algorithm simulates a random walk to collect an initial set of edges, which serves as the base layer ($L_2$).
  2. Layer-by-Layer Extension: To find larger structures (like triangles, 4-cliques, etc.), it iteratively samples a motif from the previous layer and extends it by querying the neighborhood oracle for one additional vertex.
  3. Strict Assignment Function: To avoid double-counting, a rigorous mathematical assignment rule ensures each larger motif maps uniquely back to a single parent motif from the previous layer.
Figure 2: Example of a segmentation.

To prove this method works theoretically, the authors introduce a new structural classification called $c$-dense motifs. A motif is $c$-dense if it can be broken down into smaller connected sub-motifs where each newly added vertex meets a minimum degree requirement (e.g., a perfect clique is 0-dense, while a clique missing a single edge is 1-dense).

Datasets

The algorithm was evaluated on five large-scale, real-world social network and web graph datasets from standard benchmarks:

  • soc-orkut: 3M vertices, 213M edges
  • soc-sinaweibo: 59M vertices, 523M edges
  • socfb-konect: 59M vertices, 185M edges
  • soc-livejournal: 5M vertices, 85M edges
  • soc-twitter-higgs: 457K vertices, 12.5M edges

Key Insights and Ideas

  • Arboricity Binds Variance: The core theoretical breakthrough relies on connecting the count of $c$-dense motifs to a graph's arboricity ($\alpha$)—a measure of how dense a graph is overall. The authors prove that the total degree of these motifs is bounded by the arboricity. This guarantees that the variance of the hierarchical estimator remains low, even in sparse graphs with locally dense pockets.
  • Overcoming Dependent Samples: Because random walks generate dependent samples, standard independent and identically distributed (i.e.d.) bounds fail. The authors successfully leverage Markov chain mixing time ($\tau_{mix}$) and relaxation time ($\tau_{rel}$) to prove high-probability concentration bounds.

Key Results

  • Sub-linear Query Complexity: DeMEtRIS is the first algorithm for the random walk model that is mathematically proven to require a sub-linear number of queries relative to the total number of edges and vertices.
  • High Accuracy with Minimal Crawling: Across almost all datasets and motifs (including triangles, 4-cliques, 4-chord cycles, 5-cliques, and almost-5-cliques), DeMEtRIS achieved a median relative error of less than 5% while visiting at most 4% of the edges.
Figure 1: Accuracy of DeMEtRIS on real datasets: soc-orkut (3M vertices, 213M edges), soc-sinaweibo (59M vertices, 523M edges), socfb-konect(59M vertices, 185M edges) soc-twitter-higgs(457K vertices, 12.5M edges), soc-livejournal(5M vertices, 85M edges). We observe at most 4% of the edges and repeat the experiments for 100 times. For 100 independent runs, DeMEtRIS achieves remarkable median relative error of less than 5% for most of the cases.
  • Outperforming the Baseline: DeMEtRIS was compared against SRW2, a state-of-the-art random walk motif counter. DeMEtRIS consistently delivered significantly lower median relative error. This advantage was especially pronounced in datasets where target motifs were rare (e.g., 5-cliques in socfb-konect), where the baseline failed to converge accurately even after exploring 5–7% of the graph.
Figure 5: Comparison against baseline. For each dataset, for each motif, and for a fixed length of random walk, we run both the algorithms 100 times. We compare the median relative error in estimation vs the percentage of edges visited.

Limitations and Future Work

  • Parameter Dependence: The algorithm's query efficiency depends on the graph's mixing time ($\tau_{mix}$) and arboricity ($\alpha$). For graphs that mix very slowly or have exceptionally high arboricity, the required query budget will increase.
  • Scope Restriction: The current mathematical guarantees are strictly tied to dense structures ($c$-dense motifs). While this covers cliques and near-cliques, it does not apply to sparse motifs like long paths or large cycles. Expanding this crawling framework to arbitrary, sparse subgraphs remains an open challenge.

Summary updated

Abstract

We study the problem of approximately counting cliques and near cliques in a graph, where the access to the graph is only available through crawling its vertices; thus typically seeing only a small portion of it. This model, known as the random walk model or the neighborhood query model has been introduced recently and captures real-life scenarios in which the entire graph is too massive to be stored as a whole or be scanned entirely and sampling vertices independently is non-trivial in it. We introduce DeMEtRIS: Dense Motif Estimation through Random Incident Sampling. This method provides a scalable algorithm for clique and near clique counting in the random walk model. We prove the correctness of our algorithm through rigorous mathematical analysis and extensive experiments. Both our theoretical results and our experiments show that DeMEtRIS obtains a high precision estimation by only crawling a sub-linear portion on vertices, thus we demonstrate a significant improvement over previously known results.
BibTeX
@inproceedings{bera2023demetris,
  author = {Suman K. Bera and Jayesh Choudhari and Shahrzad Haddadan and Sara Ahmadian},
  title = {{DeMEtRIS: Counting (near)-Cliques by Crawling}},
  booktitle = {WSDM},
  year = {2023},
  doi = {10.1145/3539597.3570438},
}
Figure