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

RetGK: Graph Kernels based on Return Probabilities of Random Walks

Zhen Zhang, Mianzhi Wang, Yijian Xiang, Yan Huang, Arye Nehorai

This NeurIPS 2018 paper introduces a powerful and scalable framework for measuring the similarity between graphs. By moving away from traditional substructure matching and toward a "structural role" approach, the authors provide a solution that handles complex node attributes and massive datasets with ease.

TL;DR

RetGK represents graphs using the "return probabilities" of random walks—the likelihood a walker returns to its starting node after $S$ steps. This approach creates an isomorphism-invariant structural fingerprint that handles both discrete and continuous attributes while achieving state-of-the-art accuracy and order-of-magnitude speedups on large-scale social networks.

What Problem Does This Paper Address?

Quantifying the similarity between graphs is a fundamental challenge in machine learning. Most existing methods, known as R-convolutional kernels, work by breaking graphs down into small substructures (like paths, subtrees, or graphlets) and comparing them.

However, these methods face three major hurdles:

  1. Diagonal Dominance: As you look at larger, more complex substructures to capture more detail, the probability that two different graphs share the exact same substructure drops to nearly zero. This makes every graph look completely unique, rendering the "similarity" measure useless.
  2. Attribute Integration: Many real-world graphs have a mix of discrete labels (e.g., atom types) and continuous attributes (e.g., 3D coordinates). Most kernels struggle to integrate both types effectively.
  3. Scalability: Comparing all pairs of nodes across two graphs is computationally expensive ($O(n^2)$), making it impossible to process social networks with millions of nodes.

Methods

The authors propose a new node descriptor called the Return Probability Feature (RPF).

1. The RPF Descriptor

For every node in a graph, the RPF calculates a vector of probabilities: "What is the chance a random walk starting here returns to this exact node in 1 step? 2 steps? ... up to $S$ steps?"

Graph structure and corresponding return probability curves for selected nodes.
  • Isomorphism Invariant: If two graphs are identical, their sets of RPFs will be identical.
  • Multi-resolution: Short walks capture local connectivity, while longer walks capture the node's role in the global topology.

2. Hilbert Space Embedding

To compare graphs, the authors treat the RPF as just another node attribute. They embed the distribution of these attributes (RPF + discrete labels + continuous features) into a Reproducing Kernel Hilbert Space (RKHS). This allows them to represent an entire graph as a single point in a high-dimensional space.

3. RetGK II: The Scalable Version

To solve the scalability issue, the authors use Approximate Explicit Feature Maps (specifically Random Fourier Features). Instead of calculating expensive kernel matrices between every pair of nodes, they represent each graph as a multi-dimensional tensor. Similarity then becomes a simple inner product of these tensors, which is significantly faster. For massive graphs, they use Monte Carlo simulations to estimate the RPFs rather than exact matrix math.

Datasets

The authors evaluated RetGK on 21 benchmark datasets across four categories:

  • Non-attributed (Social Networks): COLLAB, IMDB-BINARY/MULTI, REDDIT-BINARY, REDDIT-MULTI (5K/12K).
  • Discrete Attributes (Bio/Chem): MUTAG, NCI1, PROTEINS, PTC, DD.
  • Continuous Attributes: FRANK, SYNTHETIC, Synthie.
  • Mixed Attributes: ENZYMES, BZR, COX2, DHFR.

Key Insights and Ideas

Comparison of Eigenvector Embedding and RPF Embedding.
  • RPF as a Structural Fingerprint: The paper rigorously proves that RPF is not just a heuristic; it is deeply tied to the graph's spectral properties (eigenvalues). It captures nearly all the structural information that spectral methods do, but in a way that is stable and easy to compare across different graphs.
  • Bridging the Gap: By treating structural roles (RPF) as an attribute, the authors created a "unified framework." You no longer need different algorithms for labeled vs. unlabeled graphs.
  • Efficiency via Tensors: The move from $O(n^2)$ node-to-node comparisons to $O(n)$ tensor construction is the "aha moment" for scalability. It allows the kernel to handle graphs that would crash traditional algorithms.

Key Results

  • Superior Accuracy: RetGK outperformed state-of-the-art baselines (like the Weisfeiler-Lehman kernel and Deep Graph Kernels) on most datasets. On social networks like REDDIT-BINARY, it achieved 92.6% accuracy, outperforming the next best baseline by over 6%.
  • Massive Speedups: On the REDDIT-MULTI(12K) dataset, the Monte Carlo version (RetGKII(MC)) took only 6 minutes, whereas the standard Weisfeiler-Lehman kernel took over 2 hours.
  • Stability: Sensitivity analysis showed the model is robust; performance doesn't swing wildly when you change the number of random walk steps ($S$) or the dimension of the feature maps.

Limitations and Future Work

  • Hyperparameter Selection: While robust, the user still needs to define the walk length $S$ and the dimensions of the approximate feature maps, which may require some trial and error.
  • Directed Graphs: The current work focuses on undirected graphs. While random walks can be performed on directed graphs, the "return probability" logic might need adjustment to account for dead ends or sinks.
  • Comparison to Modern GNNs: While it beat early Graph Neural Networks (like PSCN), the paper was published just as the GNN explosion began. Comparing this "hand-crafted" structural feature to modern self-supervised graph representations remains an open area of interest.

Summary updated

BibTeX
@inproceedings{zhang2018retgk,
  author = {Zhen Zhang and Mianzhi Wang and Yijian Xiang and Yan Huang and Arye Nehorai},
  title = {{RetGK: Graph Kernels based on Return Probabilities of Random Walks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
}
Figure