Counting Motifs with Graph Sampling

Jason M. Klusowski, Yihong Wu · DOI

Abstract

Applied researchers often construct a network from a random sample of nodes in order to infer properties of the parent network. Two of the most widely used sampling schemes are subgraph sampling, where we sample each vertex independently with probability $p$ and observe the subgraph induced by the sampled vertices, and neighborhood sampling, where we additionally observe the edges between the sampled vertices and their neighbors. In this paper, we study the problem of estimating the number of motifs as induced subgraphs under both models from a statistical perspective. We show that: for any connected $h$ on $k$ vertices, to estimate $s=\mathsf{s}(h,G)$, the number of copies of $h$ in the parent graph $G$ of maximum degree $d$, with a multiplicative error of $ε$, (a) For subgraph sampling, the optimal sampling ratio $p$ is $Θ_{k}(\max\{ (sε^2)^{-\frac{1}{k}}, \; \frac{d^{k-1}}{sε^{2}} \})$, achieved by Horvitz-Thompson type of estimators. (b) For neighborhood sampling, we propose a family of estimators, encompassing and outperforming the Horvitz-Thompson estimator and achieving the sampling ratio $O_{k}(\min\{ (\frac{d}{sε^2})^{\frac{1}{k-1}}, \; \sqrt{\frac{d^{k-2}}{sε^2}}\})$. This is shown to be optimal for all motifs with at most $4$ vertices and cliques of all sizes. The matching minimax lower bounds are established using certain algebraic properties of subgraph counts. These results quantify how much more informative neighborhood sampling is than subgraph sampling, as empirically verified by experiments on both synthetic and real-world data.

Introduction

In fields ranging from sociology to bioinformatics, researchers often work with massive networks—such as the global Facebook graph or complex protein-interaction networks—that are impossible to observe in their entirety. Instead, they rely on sampling. A fundamental task in network analysis is counting motifs: small, recurring patterns of connectivity like triangles, wedges, or cliques. These motifs serve as the "building blocks" of complex networks, revealing underlying structural properties.

The central challenge is one of statistical inference: if only a tiny fraction of nodes is observed, how can we accurately estimate the total number of motifs in the parent graph? This paper provides the first rigorous statistical analysis of motif counting under two popular graph sampling models, deriving optimal sampling rates and demonstrating the fundamental superiority of neighborhood-based approaches.

Sampling Models

The study focuses on two primary sampling schemes:

  1. Subgraph Sampling: Each vertex is sampled independently with probability $p$. The observer sees the subgraph induced by these sampled vertices and all edges between them.
  2. Neighborhood Sampling (Ego-centric): Vertices are sampled with probability $p$, but for every sampled vertex (the "root"), the observer also sees all its neighbors and the edges connecting them.
Comparison of (a) Parent graph, (b) Subgraph sampling, and (c) Neighborhood sampling.

As illustrated above, neighborhood sampling provides a much richer view of the local topology for the same number of "initial" node selections compared to simple subgraph sampling.

Innovation: Beyond Horvitz-Thompson

Standard statistical practice often relies on the Horvitz-Thompson (HT) estimator, which weights observed counts by the inverse of their sampling probability to ensure an unbiased result. While the authors demonstrate that HT is optimal for subgraph sampling, they find it is significantly suboptimal for neighborhood sampling, particularly in high-degree graphs.

To address this, the authors propose a new family of estimators that utilize color information. In neighborhood sampling, nodes in the sample are categorized as either "roots" (intentionally picked) or "neighbors" (pulled in by roots). By treating these roles differently and—counter-intuitively—assigning negative weights to certain observed patterns, the estimators can cancel out heavy correlations and drastically reduce variance. This "negative weight" trick is essential for de-biasing overlapping observations where the same edge might be seen multiple times through different sampled neighbors.

Key Theoretical Results

The paper establishes "minimax lower bounds," proving that no possible algorithm can outperform the proposed methods for subgraph sampling (universally) and neighborhood sampling (for cliques and motifs up to 4 vertices).

A key finding is the difference in how the required sampling probability $p$ scales with the motif size $k$:

  • Subgraph Sampling: The difficulty depends primarily on the number of vertices $k$. To estimate a motif count $s$ with relative error $\epsilon$, $p$ scales roughly as $s^{-1/k}$.
  • Neighborhood Sampling: The scaling improves significantly to approximately $s^{-1/(k-1)}$.

These results quantify the "power-up" provided by neighborhood sampling. Furthermore, the authors show that if the parent graph has specific structural properties (e.g., being a forest or a planar graph), even lower error rates are achievable.

Empirical Validation

The theoretical bounds were validated using both synthetic and real-world datasets:

  • Synthetic Graphs: Erdős-Rényi random graphs were used to test the impact of maximum degree and edge density.
  • Real-World Data: Facebook ego-networks from the SNAP dataset provided a testbed for actual human social structures, which typically exhibit high clustering.

Experiments on the Facebook data consistently showed that neighborhood sampling produces estimates with much lower standard deviation than subgraph sampling at the same sampling ratio $p$, confirming the theoretical predictions.

Conclusion and Future Work

This work provides a definitive theoretical foundation for motif estimation. While the bounds are proven optimal for small motifs and cliques, the authors conjecture they are optimal for all connected motifs—a proof of which remains an open challenge. Future research may also extend these findings to "$r$-hop sampling" (snowball sampling), where observers see neighbors of neighbors and beyond.

Summary updated

BibTeX
@inproceedings{klusowski2018counting,
  author = {Jason M. Klusowski and Yihong Wu},
  title = {{Counting Motifs with Graph Sampling}},
  booktitle = {Conference on Learning Theory},
  year = {2018},
}
Figure