Manuscript Offprint
arXiv:2610.40956Monte Carlo Random Walk Kernel
Abstract
We introduce the Monte Carlo Random Walk Kernel (MCRWK), an estimator whose per-pair cost is independent of graph size and derived directly from the random walk kernel (RWK) expansion. By normalizing the kernel coefficients, MCRWK samples a shared walk length and estimates its contribution using random walks on the input graphs. This gives a simple way to approximate RWK without constructing the product graph. For a fixed expected walk length and efficient neighbor sampling, each pairwise estimate takes time for Monte Carlo samples, allowing the sample budget to control the trade-off between runtime and accuracy. We evaluate MCRWK against Graph Voyagers and classical RWK methods on synthetic and real graph datasets. In the reported experiments on large synthetic graphs, MCRWK is faster than Graph Voyagers and, at matched runtime, more accurate. It also has the lowest Gram-matrix runtime on the five real datasets studied. Code and experiments are available at https://github.com/arslan-yam/random_walk_kernels_computations
1 Introduction
Graphs are universal data structures that model relational information across diverse domains, including chemoinformatics (molecular graphs), bioinformatics (protein-protein interaction networks), neuroscience (connectomes), and social network analysis. A central task in these settings is to measure graph similarity for downstream problems including classification, clustering, and regression. Kernel methods address this task by defining a positive semi-definite kernel , which implicitly embeds graphs into a Hilbert space where inner products encode similarity.
In this paper, we consider Random Walk Graph Kernels (RWK). Given two unweighted graphs and , with vertices and respectively, their product graph is the direct product of vertices and edges of and :
Then, general RWK on can be computed as:
Here is the normalized adjacency matrix of the product graph, is a non-negative coefficient sequence that defines kernel type, and denote starting and stopping distributions over the product graph. These distributions are typically and , where is Kronecker product.
The main computational bottleneck of RWKs is the product graph: for two -vertex graphs, it has vertices, and direct computation costs . Vishwanathan et al. (2010) reduced this to using Sylvester equations. More recently, Choromanski et al. (2025b) introduced Graph Voyagers (GVoys), the first linear-time algorithm for general RWKs on sparse graphs. GVoys avoid constructing the product graph by correlating random walks on the two input graphs through shared random variables, yielding unbiased estimates for labeled and unlabeled graphs.
We propose Monte Carlo Random Walk Kernel (MCRWK), a simpler -time estimator for RWKs, where denotes the number of Monte Carlo samples. Like GVoys, MCRWK relies on synchronized random walks, but it samples the shared walk length directly from the normalized kernel coefficient distribution. This removes the need for auxiliary Rademacher variables and avoids anchor-point selection while preserving unbiasedness. The resulting algorithm is empirically faster on large graphs, while maintaining comparable approximation error to GVoys and unbiasedness. Our contributions are as follows: (i) We introduce MCRWK, a Monte Carlo estimator for random walk graph kernels with -time scaling; (ii) its derivation for unlabeled and labeled graphs, including geometric and exponential kernels; (iii) proofs of unbiasedness and variance bounds showing that the sample complexity does not depend on graph size; and (iv) an empirical comparison with classical RWK baselines and GVoys, demonstrating faster and more accurate computation on large graphs, complemented by evaluations of Gram-matrix construction and downstream classification and regression on real graph datasets.
Cubic-Time Algorithms. The first major algorithmic improvement came when Borgwardt et al. (2006) proposed to compute RWK through Sylvester equations. The later work of Vishwanathan et al. (2010) proposed a unifying framework that exploits the Kronecker product structure of the product graph. When the product graph adjacency matrix factorizes as , the kernel reduces to a Sylvester equation; for labeled graphs with edge labels, it reduces to a generalized Sylvester equation . The Sylvester approach runs in time; conjugate gradient (CG) and fixed-point iteration (FPI) reduce this further on sparse graphs by exploiting fast matrix-vector products. The performance of these methods is ultimately bounded by the convergence of the underlying iterative solvers. Subsequent work refines the Sylvester (Du and Tong, 2018; Tian et al., 2024), CG (Zhang and Wang, 2012) and FPI (Kolesnikov and Oseledets, 2018) subroutines, but none achieves linear time complexity.
Linear-time approximation: Graph Voyagers. The first step toward linear-time RWK computation was achieved by Kang et al. (2012) for the geometric kernel . More recently, Choromanski et al. (2025b) introduced Graph Voyagers (GVoys), the first linear-time algorithm for general RWKs. GVoys avoids instantiating the product graph by sampling random walks on and and correlating them through shared Rademacher variables and , which in expectation cancel out walks that mismatch in length or label. The resulting Graph Random Features (Choromanski, 2023) produce low-dimensional embeddings whose dot product is an unbiased estimate of the RWK. With walks and anchor points the time complexity is , which is linear in . Further works on GRFs introduce generalizations (Reid et al., 2024), new optimized approaches to compute them (Choromanski et al., 2025a) and extend the applications of GRFs to new domains (Manenti et al., 2026).
Novel Monte Carlo approach. Our proposed Monte Carlo Random Walk Kernel (MCRWK) shares the same goal of unbiased estimation, but adopts a different strategy. Instead of factorizing and introducing extra Rademacher variables to align walk lengths, we directly sample a shared walk length from the normalized distribution , where . This observation enables a plain Monte Carlo estimator that requires no deconvolution, no or variables, and no anchor point selection. For labeled graphs, an extra importance-sampling step over label sequences replaces the complicated -variable mechanism, allowing flexible tuning of the proposal distribution .
3 Methods
We now derive MCRWK for unlabeled and labeled graphs. Let and be two graphs with adjacency matrices and . Their normalized adjacency matrices are , , where is a diagonal matrix with vertex degrees on the diagonal. As in Equation 1, the RWK is computed on the product graph . In the unlabeled case, its transition matrix is . Write and .
Let be a non-negative sequence with finite sum . We define a random variable via the probability function . The random walk kernel takes the form
Two natural choices of yield standard kernels:
Geometric kernel. Setting for gives and :
Exponential kernel. Setting gives and :
3.1 Unlabeled case
When the product graph adjacency matrix factorizes as , the mixed-product property of the Kronecker product gives , and the kernel can be written as
(2)
This factorization allows us to simulate independent random walks on and separately, without explicitly constructing the product graph. By sharing the random walk length across graphs, the estimator remains unbiased while achieving complexity that is independent of graph size. Moreover, the walks for each graph are simulated once and reused across all pairs, so the random walk simulation scales linearly with the number of graphs in the dataset.
3.2 Labeled case
The unlabeled construction extends naturally to labeled graphs. When edges carry labels from a set , the weight matrix takes the form , where is the normalized adjacency matrix of graph restricted to edges with label l. For a label sequence , write . Expanding gives
For a fixed label sequence , the term is simply the expected terminal weight of a random walk on where step is restricted to edges with label . Writing for this quantity, the kernel becomes
Summing over all label sequences is computationally expensive, so we approximate this sum via importance sampling. Let , , , be a distribution over labels, and sample . The probability of a sequence under is , so the sum rewrites as an expectation:
where we define to symmetrically split the importance weight between the two graphs. The kernel then takes the form
which we estimate via Monte Carlo by sampling and .
(3)
Algorithm 1 Walk function
function WALK() Sample , weight for do weight weight if weight = 0 then return 0 end if normalize end for return weight end function
Unbiasedness. By construction, the MCRWK estimator is unbiased for any non-negative coefficient sequence with finite sum , provided that the two factors are sampled independently:
For diagonal entries, Algorithm 2 reuses the same sample for both factors, introducing an upward bias:
where the conditional variance is taken over the walk, at a fixed walk length and label sequence (in the unlabeled case the conditioning on is vacuous). Keeping this diagonal yields a positive semi-definite Gram matrix. Alternatively, we obtain an unbiased diagonal by generating two independent copies, and , of and using their product instead of the squared sample. The resulting estimator is unbiased, since
Algorithm 2 Monte Carlo estimation of Gram matrix — labeled case
Require: For each , label-indexed transition matrices , initial distribution and stopping distribution ; importance sampling distribution over ; coefficient sequence with sum ; length samples and label samples per length
Ensure: Gram matrix with
1: Sample shared walk lengths
2: for do
3: for do
4: Sample label sequence
5: Compute
6: end for
7: end for
8: for do
9: for do
10: for do
11:
12:
13: end for
14: end for
15: end for
16: for do
17: for do
18:
19: end for
20: end for
21: return
3.3 Variance Bounds
Unlabeled case For terminating distribution let . Each feature product (Alg. 2) is non-negative and bounded by , since . As the samples are i.i.d.,
(6)
Since the estimator is unbiased, this is also a bound on its mean squared error. The standard deviation decays at a rate
Applying Hoeffding's inequality gives
So to achieve absolute error at most with probability at least it suffices to take
This bound is independent of the graph size , the edge count , and the dataset size . The sample budget needed for a target precision depends only on the kernel parameter, the magnitudes of the boundary distributions, and the target precision.
Labeled case Let and . For walk lengths and label sequences per length,
Chebyshev's inequality then gives
so absolute error at most with probability at least is guaranteed whenever
As in the unlabeled case, the required budget has no explicit graph-size dependence.
Here controls the label-sampling variance, while also controls the walk-length variance, which cannot be reduced by increasing alone. For a fixed walk budget , is optimal. The derivation and the budget comparison are given in Appendix A.4.
For the geometric kernel, is finite when . For the exponential kernel, is always finite. Uniform minimizes this worst-case bound, although frequency-based proposals can reduce the actual variance in practice.
3.4 Pairwise complexity
Unlabeled case. Let be the expected walk length under the sampling distribution. For the two standard kernels , both independent of the graph size , so for fixed kernel parameter . Consider two graphs with vertices and average degrees . Sampling the shared walk lengths in line 1 of Algorithm 3 (Appendix A.1) costs . On graph , simulating a walk of length requires neighbour-sampling steps, each performed in time when is stored in sparse (CSR) format, a single row of has at most non-zero entries on average. Summing over all walks and taking the expectation over ,
The estimate is one dot product costing . The total pairwise time is
For sparse graphs of bounded degrees we have , therefore is independent of the number of vertices . If one lets the sample budget scale with graph size, for some constant the per-pair cost becomes , recovering the linear scaling of GVoys (Choromanski et al., 2025b) but without the , , or anchor-point factors.
Labeled case. Algorithm 2 additionally samples n label sequences per walk length, so the total pairwise cost is
This can be free of any explicit -dependence on sparse graphs, or linear if we let . Also in contrast to the cost of summing over label sequences exactly this is linear in
Table 1: Pairwise RWK time and space complexity. : vertices per graph; : edges; : average degree; : number of edge labels; : Monte Carlo samples; : expected walk length. On sparse graphs of bounded degree, MCRWK time is independent of .
| Method | Pairwise time | Space |
|---|---|---|
| Direct | ||
| Sylvester | ||
| CG / FPI | ||
| GVoys | ||
| MCRWK |
Memory. MCRWK does not build the product graph. It stores the sparse adjacency matrices, , and the feature vectors , so
versus for the direct method and for Sylvester / CG / FPI, and for GVoys, whose feature vectors carry an extra factor of from the anchor points.
3.5 Dataset complexity
A central practical advantage of MCRWK on a dataset is that the walk lengths – and, in the labeled case, the label sequences – are sampled once and reused across all graphs. Once per-graph Monte Carlo features are precomputed, every kernel evaluation reduces to a dot product, independent of graph size.
For each graph the feature vector takes to compute, with the average degree (in the unlabeled case ). So for the dataset the time complexity for computing features is . This step is linear in and is parallelizable across graphs.
Given the precomputed features, the kernel value for any pair is , which takes time. This makes MCRWK particularly suited to settings where the same dataset is queried repeatedly. Storing the input graphs and precomputed features requires .
Stacking the features into a matrix , the off-diagonal part of the approximate Gram matrix is given by
which has rank at most . So MCRWK gives a low-rank factorization of the Gram matrix in time linear in . This avoids rerunning a pairwise RWK solver for each of the graph pairs. The explicit Gram matrix costs , but it is often not needed, since kernel methods such as ridge regression, SVM or kernel PCA can work directly with as a linear model on explicit features, in time linear in .
There are two options for the diagonal. First, the diagonal entries can be replaced by the unbiased estimate (5), computed from an independent copy of the features. Then the Gram matrix is the sum of a low-rank and a diagonal matrix, but it is no longer guaranteed to be positive semi-definite. Second, the diagonal of (16) can be kept as is. Its bias is , so . This works as a graph-dependent ridge regularization and keeps positive semi-definite.
4 Experiments
We compare MCRWK against five baselines: direct, conjugate gradient (CG), fixed-point iteration (FPI), the Sylvester-equation method and GVoys.
Setup. Unless stated otherwise we use the geometric kernel with , so and the expected walk length is . To avoid the degenerate kernel (Appendix A.2) we draw with and independently in the same way; all methods use the same and .

Figure 1: Runtime (left) and relative error (right) of a single kernel value vs graph size, for pairs of labeled random graphs with edge labels, averaged over four graph families. MCRWK with and GVoys have matching runtimes by construction, so their curves overlap on the left.
In the labeled case MCRWK samples label sequences from the uniform proposal , which maximizes and therefore gives the bound of Section 3.3 the best chance of being finite, with sequence per length, which is optimal for a fixed budget. Appendix A.8 shows that frequency-based proposals are empirically more accurate. MCRWK is run in two regimes: a fixed budget , independent of the graph size as the size-free bounds suggest, and a linear budget , whose constant is calibrated so that MCRWK and GVoys take the same time. The baselines, the symmetric transform through which GVoys is applied to our non-symmetric , the protocols and the hardware are described in Appendix A.3.
4.1 Scaling with graph size
We first measure the cost and accuracy of a single kernel evaluation as the graphs grow. For every size we draw pairs of graphs from four random-graph families (Barabasi–Albert, Erdos–Renyi, Watts–Strogatz and a stochastic block model; Appendix A.3) and average over them. In the labeled setting every edge receives one of labels uniformly at random. Each method computes only the pair value , so the reported time is the per-pair cost. Figure 1 shows runtime and relative error.
Runtime. At MCRWK with the three fixed budgets takes 0.60, 0.64 and 1.12 s, while GVoys takes 46.8 s, CG 519 s and FPI about 1000 s. MCRWK with takes 44.8 s, matching GVoys by construction. MCRWK with is thus about faster than CG and faster than FPI.
Accuracy. With a fixed budget the error of MCRWK does not depend on the graph size: it stays within 5.9–9.2%, 2.1–2.7% and 1.0–1.5% for across three orders of magnitude of , matching the size-free sample complexity, and it falls by a factor of 3.2 from to , as predicts, though only by 1.9 at the next tenfold step, where the heavy-tailed labeled weights slow the rate (Appendix A.7). At equal runtime MCRWK is more accurate than GVoys, which keeps an error of 5.3–7.5% at every size, 2.8 to 41 times that of MCRWK with . Unlabeled graphs behave the same way (Appendix A.5).
4.2 Gram matrix computation
Kernel methods require a full dataset Gram matrix rather than a single kernel value. We measure its computation time on three edge-labeled TU datasets (Morris et al., 2020): AIDS (2000 graphs), MUTAG

Figure 2: Time to compute the Gram matrix of a whole dataset with edge labels
(188) and PTC_MR (344). Exact methods solve linear systems, one per graph pair, while GVoys and MCRWK compute features once per graph and form the Gram matrix by one matrix multiplication (Section 3.5); Figure 2 reports feature construction and total time separately. The unlabeled case, including ENZYMES and NCI1, is in Appendix A.6.
Fixed-budget MCRWK is fastest on all three datasets. On AIDS its Gram times are 2.3, 9.0 and 73s for , against s for Direct, the fastest exact method, s for FPI and s for CG: is faster than Direct and faster than CG, and over faster than Direct. The gap is smaller but still substantial on MUTAG and PTC_MR, where MCRWK takes 0.27–6.8s and 0.38–9.5s across the three budgets, against 31s and 66s for Direct. Feature construction accounts for over 98% of the total time of both MCRWK and GVoys.
4.3 Application: learning on labeled graphs
Finally we use the kernels for classification on MUTAG (188 graphs) and regression of the constrained solubility on ZINC_test (5000 graphs), both with bond types as edge labels. We keep and set , the uniform choice standard for this application of RWK, which is degenerate only without edge labels (Appendix A.2). Appendix A.11 compares it with the normal vectors used elsewhere and with a degree-based choice. Each normalized Gram matrix feeds an SVC or an SVR tuned by nested cross-validation. Since GVoys and MCRWK also produce explicit features, we additionally fit a linear SVM or SVR on those, at a cost linear in the number of graphs. The protocol is given in Appendix A.3. The exact methods give the same predictions, so we report only Direct.
Figure 3 shows the results. On ZINC_test the exact kernel reduces the RMSE from 1.988 for the constant predictor, the standard deviation of the target, to 1.518, but its Gram matrix takes s, that is 6.3 hours. MCRWK with reaches 1.590 in 191s, faster, recovering 85% of that improvement, and reaches 1.617 in 24s. The RMSE decreases with the budget (1.695, 1.617, 1.590), and at matched runtime MCRWK is slightly ahead of GVoys.
On MUTAG the exact kernel reaches an accuracy of 0.761 against 0.665 for the majority class, and MCRWK with reaches 0.736 in 14s, above GVoys (0.720 in 21s). The remaining gap of about two points is consistent with the error analysis: with four edge labels and uniform , exceeds , so the variance of the labeled estimator is not controlled by the bound of Section 3.3, and Appendix A.10 shows the error growing with in this regime. The linear models on the explicit features are as good as

Figure 3: Prediction quality against the Gram time on labeled graphs (, uniform )
the kernel models built on the same estimators, so MCRWK does not need the Gram matrix. Results on PTC_MR, AIDS and the full table of models are reported in Appendix A.12.
5 Discussion
The experiments support the main claim of the paper: MCRWK is a faster and more accurate estimator for RWKs, with a per-pair cost independent of graph size and, at matched runtime, a lower approximation error than GVoys. The gain is most visible on large sparse graphs, where MCRWK avoids auxiliary random variables, anchor points, and product-graph construction.
5.1 Limitations
Choice of . In the labeled case the variance depends on the proposal distribution . Our bound depends on only through , which is minimized by the uniform distribution. This is because the bound uses and ignores that is small for rare label sequences. The exact second moment depends on , so proposals based on empirical label frequencies can reduce the variance. Since label sequences are shared across the dataset, must be chosen globally. The choice of also affects runtime: with uniform on imbalanced labels, many walks stop early with zero weight. The effects of on runtime and estimation error are studied in Appendix A.8; adaptive choices of are left for future work. The bound (9) is also finite only when , so the of our experiments lies outside that regime: the estimator stays unbiased and its error still falls with , but more slowly than (Appendices A.7 and A.10).
Coefficient sequences. MCRWK requires to sample the walk length . With normalized matrices this is mild: is stochastic, so typically converges to a positive constant, and for non-summable the kernel itself is infinite. But finite is not enough for efficiency: a walk takes steps, so the expected cost is with . For heavy-tailed sequences, such as , is finite but is infinite. The estimator is still unbiased, but its expected runtime is unbounded. Thus, MCRWK is efficient when , which holds for the geometric and exponential kernels.
5.2 Why random walk kernels
Although GNNs are now the default in graph learning, RWKs remain useful (Borgwardt et al., 2020). They require no training and lead to convex problems such as SVM or kernel ridge regression. This makes them attractive for small datasets, where GNNs often overfit and simple baselines are competitive (Errica et al., 2020). RWKs are also interpretable, since the kernel counts common walks, and can be used in Gaussian processes to estimate uncertainty. Finally, random walk statistics are widely used inside modern models: as positional encodings in GNNs and graph transformers (Dwivedi et al., 2022; Rampásek et al., 2022), as learnable kernels (Lee et al., 2024), and as graph random features (Choromanski, 2023; Reid et al., 2024; Manenti et al., 2026).
MCRWK is therefore most useful for repeated similarity queries and for building a full Gram matrix, as a feature-engineering step in pipelines where the dataset is too small to train a GNN.
6 Conclusion
We introduced Monte Carlo Random Walk Kernel (MCRWK), an estimator for random walk graph kernels with -time scaling. The method rewrites the RWK as an expectation over a shared random walk length sampled directly from the normalized kernel coefficient distribution. This yields an unbiased estimator that avoids explicit product-graph construction, auxiliary Rademacher variables, and anchor-point selection.
We derived MCRWK for unlabeled and labeled graphs, showed how it recovers geometric and exponential RWK special cases, and provided variance bounds demonstrating that the sample budget required for a target precision is independent of graph size. Empirically, MCRWK is faster than GVoys and classical RWK baselines on large graphs, and more accurate than GVoys at matched runtime.
Future work includes improving the label-sequence proposal distribution in the labeled case and extending the method to richer graph attributes.
AI Use Statement
In this work, we used generative AI tools to identify and summarize relevant literature, to suggest revisions to the algorithms and experimental procedures, and to proofread and rephrase parts of the manuscript. The authors reviewed all AI-assisted suggestions, checked the cited works against the original sources, and verified the final methods and experimental results. We take full responsibility for the content of this submission.
References
Karsten Borgwardt, Nicol Schraudolph, and S.v.n. Vishwanathan. Fast computation of graph kernels. In B. Schölkopf, J. Platt, and T. Hoffman, editors, Advances in Neural Information Processing Systems, volume 19. MIT Press, 2006. URL https://proceedings.neurips.cc/paper_files/paper/2006/file/e37b08dd3015330dcbb5d6663667b8b8-Paper.pdf.
Karsten Borgwardt, Elisabetta Ghisu, Felipe Llinares-López, Leslie O'Bray, and Bastian Rieck. Graph kernels: State-of-the-art and future challenges. Found. Trends Mach. Learn., 13(5-6):531-712, December 2020. ISSN 1935-8237. doi: 10.1561/2200000076. URL https://doi.org/10.1561/2200000076.
Krzysztof Choromanski, Avinava Dubey, Arijit Sehanobish, and Isaac Reid. Computationally-efficient graph modeling with refined graph random features, 2025a. URL https://arxiv.org/abs/2510.07716.
Krzysztof Marcin Choromanski. Taming graph kernels with random features. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 5964-5977. PMLR, 23-29 Jul 2023. URL https://proceedings.mlr.press/v202/choromanski23a.html.
Krzysztof Marcin Choromanski, Isaac Reid, Arijit Sehanobish, and Kumar Avinava Dubey. Optimal time complexity algorithms for computing general random walk graph kernels on sparse graphs. In Yingzhen Li, Stephan Mandt, Shipra Agrawal, and Emtiyaz Khan, editors, Proceedings of The 28th International Conference on Artificial Intelligence and Statistics, volume 258 of Proceedings of Machine Learning
Research, pages 3457–3465. PMLR, 03–05 May 2025b. URL https://proceedings.mlr.press/v258/choromanski25a.html.
Boxin Du and Hanghang Tong. Fasten: Fast sylvester equation solver for graph mining. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD '18, pages 1339–1347, New York, NY, USA, 2018. Association for Computing Machinery. ISBN 9781450355520. doi: 10.1145/3219819.3220002. URL https://doi.org/10.1145/3219819.3220002.
Vijay Prakash Dwivedi, Anh Tuan Luu, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Graph neural networks with learnable structural and positional representations. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=wTTjnvGphYj.
Federico Errica, Marco Podda, Davide Bacciu, and Alessio Micheli. A fair comparison of graph neural networks for graph classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=HygDF6NFPB.
Thomas Gärtner, Peter A. Flach, and Stefan Wrobel. On graph kernels: Hardness results and efficient alternatives. In Computational Learning Theory and Kernel Machines (COLT/Kernel 2003), volume 2777 of Lecture Notes in Computer Science, pages 129–143. Springer, 2003.
U Kang, Hanghang Tong, and Jimeng Sun. Fast random walk graph kernel. In Proceedings of the 2012 SIAM International Conference on Data Mining (SDM), pages 828–838. SIAM, 2012. doi: 10.1137/1.9781611972825.71.
D. A. Kolesnikov and I. V. Oseledets. Convergence analysis of projected fixed-point iteration on a low-rank matrix manifold. Numerical Linear Algebra with Applications, 25(5):e2140, 2018. doi: https://doi.org/10.1002/nla.2140. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/nla.2140. e2140 nla.2140.
Meng-Chieh Lee, Lingxiao Zhao, and Leman Akoglu. Descriptive kernel convolution network with improved random walk kernel. In Proceedings of the ACM Web Conference 2024, WWW '24, pages 457–468, New York, NY, USA, 2024. Association for Computing Machinery. ISBN 9798400701719. doi: 10.1145/3589334.3645405. URL https://doi.org/10.1145/3589334.3645405.
Alessandro Manenti, Avinava Dubey, Arijit Sehanobish, Cesare Alippi, and Krzysztof Choromanski. Swing: Unlocking implicit graph representations for graph random features, 2026. URL https://arxiv.org/abs/2602.12703.
Christopher Morris, Nils M. Kriege, Franka Bause, Kristian Kersting, Petra Mutzel, and Marion Neumann. Tudataset: A collection of benchmark datasets for learning with graphs. CoRR, abs/2007.08663, 2020. URL https://arxiv.org/abs/2007.08663.
Ladislav Rampásek, Michael Galkin, Vijay Prakash Dwivedi, Anh Tuan Luu, Guy Wolf, and Dominique Beaini. Recipe for a general, powerful, scalable graph transformer. In Advances in Neural Information Processing Systems, volume 35, pages 14501–14515, 2022.
Isaac Reid, Krzysztof Marcin Choromanski, Eli Berger, and Adrian Weller. General graph random features. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=vfitsX50Rt.
Zhaolu Tian, Yudong Wang, Yinghui Dong, and Xuefeng Duan. The shifted inner-outer iteration methods for solving sylvester matrix equations. Journal of the Franklin Institute, 361(5):106674, 2024. ISSN 0016-0032. doi: https://doi.org/10.1016/j.jfranklin.2024.106674. URL https://www.sciencedirect.com/science/article/pii/S0016003224000954.
S.V.N. Vishwanathan, Nicol N. Schraudolph, Risi Kondor, and Karsten M. Borgwardt. Graph kernels. Journal of Machine Learning Research, 11(40):1201–1242, 2010. URL http://jmlr.org/papers/v11/vishwanathan10a.html.
Yang Zhang and Kairong Wang. A new general form of conjugate gradient methods with guaranteed descent and strong global convergence properties. Numerical Algorithms, 60(1):135–152, May 2012. ISSN 1572-9265. doi: 10.1007/s11075-011-9515-0. URL https://doi.org/10.1007/s11075-011-9515-0.
Monte Carlo Random Walk Kernel: Supplementary Materials
A Appendix
A.1 Algorithm for unlabeled case
Algorithm 3 Monte Carlo estimation of the Gram matrix — unlabeled case
Require: Normalized transition matrices , initial distributions , stopping distributions , sequence , sum of sequence , number of samples
Ensure: Gram matrix where
1: Sample shared walk lengths
2: for do
3: for do
4: Sample
5: for do
6:
7: end for
8:
9: end for
10: end for
11: for do
12: for do
13:
14: end for
15: end for
16: return
A.2 Degenerate kernel for uniform boundary vectors
Vishwanathan et al. (2010) use uniform distributions for the vectors and . Without edge labels this choice makes the kernel degenerate. The transition matrix is row-stochastic, so for a uniform , and
where is the number of vertices of : the kernel sees only the graph sizes. The unlabeled experiments therefore use random v and w, a normalized degree distribution works as well.
With edge labels the degeneracy disappears. The label-specific matrices are sub-stochastic, since each row of sums to the mass of label-l edges at rather than to one, so a product applied to a uniform still depends on the labeled structure of the graph. This is why the application experiments of Section 4.3 can use uniform boundary vectors, and Appendix A.11 compares them with the random ones.
A.3 Experimental setup
Baselines. Direct builds the product graph explicitly, so we run it only for , and Sylvester, which applies to unlabeled graphs only, for . CG and FPI solve the linear system matrix-free through the Kronecker structure, without forming the product graph, to a relative residual of . The reference value is computed by Direct for and by CG otherwise.
GVoys. GVoys was introduced for symmetric matrices such as the adjacency matrix . Each random feature joins a walk started from and a walk started from at a common anchor vertex, with the second walk traversed backwards. Our kernel is defined on the row-normalized, non-symmetric matrix . To apply GVoys to the same kernel as the other methods, we use the symmetric similarity transform
and transformed boundary vectors
These satisfy for every . With edge labels, each is transformed using the same . We made two corrections to the reference implementation. First, neighbours are sampled uniformly, so the load of a step is multiplied by . Second, the modulation function must satisfy , which for the geometric kernel gives rather than , and for the exponential kernel . Random numbers are drawn per feature from seeded streams. We use halting probability and all vertices as anchors, with 100 outer samples in the scaling experiment and 200 in the Gram-matrix and application experiments.
MCRWK. Each graph uses two independent walk replicas: their average gives the off-diagonal features and their product the unbiased diagonal. For the linear budget the constant is calibrated once per setting so that MCRWK and GVoys take the same time: at in the scaling experiment, and on 50 random graphs per dataset, with the mean graph size, in the Gram-matrix and application experiments.
Synthetic graphs. The synthetic experiments (Section 4.1 and Appendices A.5, A.7 and A.10) average over four random-graph families: Barabasi–Albert graphs with attachment parameter 2 and Erdos–Renyi graphs with , both sparse, with mean degree about 4 and 2, and two denser families, Watts–Strogatz small worlds with neighbours and rewiring probability 0.1, and a two-block stochastic block model with and . The exact iterative solvers are slowest on the dense families, so the speedups of Section 4.1 are averages over sparse and dense graphs; on the sparse Barabasi–Albert graphs alone, MCRWK with is still faster than CG at . The error of MCRWK does not depend on in any of the four families.
Protocols. The scaling experiment averages over at least 37 repetitions per size, each drawing new graphs, new vectors and new random seeds. The Gram-matrix and application experiments use the full datasets. In the application experiment we normalize each Gram matrix to unit diagonal, select the penalty and, for SVR, by nested cross-validation with 5 outer and 3 inner folds, standardize the regression targets within each fold, and average over three seeds. On MUTAG, Direct takes 29s against 115s for FPI and 144s for CG, which is why we report Direct as the exact baseline. The linear models are a linear SVM with squared hinge loss and a linear SVR, for MCRWK the features are the averaged replicas, whose inner products form the PSD Gram matrix with the biased diagonal.
Implementation. All methods are implemented in Python with NumPy and SciPy and run on a single CPU thread of an Intel Xeon Gold 6248R at 3.00 GHz with 768 GB of RAM. Code and scripts for all experiments are in the repository linked in the abstract.
A.4 Variance analysis for labeled graphs
In the labeled case the feature is , where is the output of the Walk function. Let
be the mass of label edges at vertex . Since is normalized by the full degree, . For a label sequence , the walk returns
Write and .
Variance decomposition. The feature products are not i.i.d.: products with the same index share the walk length . Conditional on , the label sequences and the corresponding walks are sampled independently. Writing , the law of total variance gives
First term. Fix . Given the labels, the walks on and are independent, and . Hence
where
The expectation is over the walk for the fixed label sequence . Since at every step, induction on gives . Thus
Second term. For any ,
where we used . Since , Popoviciu's inequality gives
Substituting the two bounds into (17) yields (9). Chebyshev's inequality then gives (10), and hence the sufficient sample budget in (11).
Allocation of the walk budget. Here controls the variance of label sampling, while controls the variance of the walk length, which cannot be reduced by increasing alone. For fixed , increasing reduces only the first term in (9), while the second term remains unchanged. Thus, taking larger than about gives almost no improvement.
The cost of the estimator is proportional to the total number of walks . Substituting into (17) gives
which grows with . Therefore, is optimal for a fixed budget, while is useful only when is limited.

Figure 4: Runtime (left) and relative error (right) of a single kernel value versus graph size for pairs of unlabeled random graphs from the four families of Appendix A.3, averaged over 30 repetitions. Direct runs for , Sylvester for . By construction, MCRWK with and GVoys have matching runtimes, so their curves overlap in the left panel.
A.5 Extended results for synthetic graphs
Figure 4 repeats the scaling experiment without edge labels, with the same graph families, sizes, methods and budgets. We run Sylvester for .
Runtime. As in the labeled case, MCRWK with a fixed budget is almost insensitive to the graph size: at it takes 0.30, 0.33 and 0.54s for . GVoys takes 43.5s and MCRWK with 44.3s, while CG and FPI take 596s and s. Direct reaches 0.56s already at , and Sylvester 3.7s at . On small graphs CG is competitive: it is faster than the equal-time estimators up to , and faster than MCRWK with up to . At , however, MCRWK with is about faster than CG and faster than FPI.
Accuracy. With a fixed budget the error of MCRWK again does not depend on the graph size: it stays within 4.3–6.5%, 1.3–2.0% and 0.4–0.7% for as grows from 8 to 8192. Without labels each tenfold increase of reduces the mean error by a factor of 3.0, close to the predicted by ; the slower second step seen in the labeled case does not occur here. With the linear budget the error falls from 1.3% at to 0.05% at . The gap to GVoys is larger than with labels: at matched runtime GVoys keeps an error of 17–19% at every size, 13 to 360 times that of MCRWK with .
A.6 Gram matrix computation without labels
Figure 5 repeats the experiment of Section 4.2 without edge labels, on AIDS (2000 graphs), ENZYMES (600), MUTAG (188), NCI1 (4110) and PTC_MR (344). The setup is the same and Sylvester is included.
The picture is the same as in the labeled case. On the largest dataset, NCI1, all exact methods need between and s (8 to 12 hours). MCRWK builds the same Gram matrix in 8.6, 59 and 559s for , which is 54 times faster than Direct with and about 500 times faster with . On AIDS MCRWK takes 4.0, 29 and 277s. The fastest exact method there, Direct, takes s, Sylvester, CG and FPI take and s. On ENZYMES, whose graphs are larger, CG is the fastest exact method with 858s, against 1.3, 9.0 and 86s for MCRWK. On the two smallest datasets the advantage shrinks. On MUTAG, MCRWK with takes 27s, about as long as

Figure 5: Time to compute the Gram matrix of a whole dataset without edge labels (logarithmic axis). Solid bars: total time; hatched bars: feature construction of GVoys and MCRWK, before the Gram product.
Direct (29s), and on PTC_MR it takes 49s against 63s. With MCRWK is still ten times faster on both. GVoys and MCRWK with again take similar times (640 and 678s on NCI1), and feature construction accounts for more than 98% of their total time.
The datasets also show how the two approaches scale with the number of graphs . From MUTAG to NCI1, grows 22 times and the number of graph pairs about 480 times. Over the same range, the time of MCRWK with a fixed grows 21 times, as expected for one feature map per graph and a Gram product that contributes little. The time of Direct grows about times, since it solves one linear system per pair and the NCI1 graphs are also larger.
At the same budget, MCRWK is slower without labels than with them (277 against 73s on AIDS for ). In the labeled case a walk stops as soon as the current vertex has no edge with the sampled label, so walks are shorter on average.
A.7 Convergence and tightness of the bounds
We check the bounds of Section 3.3 empirically. For each size we draw 8 graphs (28 pairs) from each of the four families of Appendix A.3, compute the exact kernel of every pair (Direct for , CG otherwise), and run MCRWK with 50 independent seeds. Budgets are nested: each seed draws samples, and the estimate for a smaller uses the first of them. Since the samples are i.i.d., this is a valid -sample estimate, and every statistic for a given is still computed over independent seeds. We use , as in the rest of the paper, and . With labels and uniform , , so the labeled bound (9) is finite only for .
Rate. Figure 6 shows the relative RMSE over all pairs. On log-log axes the curves are straight lines with fitted slopes between -0.49 and -0.52 in the unlabeled case and between -0.51 and -0.53 in the labeled case at , matching the rate. The curves for different coincide: the sample complexity does not depend on the graph size. In the labeled case at , where the bound is infinite, the slope is flatter, between -0.45 and -0.48: the heavy-tailed importance weights slow the rate down, though the error still decreases with .

Figure 6: Relative RMSE of MCRWK over all pairs of 8 graphs versus the number of samples m, for four graph sizes. The gray line has slope -1/2.

Figure 7: Frequency of a relative error above 10% (solid) and its bound (dotted): Hoeffding (7) without labels, Chebyshev (10) with labels. For labeled graphs at the bound is infinite and is not shown. Missing points have frequency 0.
Tightness. The variance bounds (6) and (9) have the right dependence but a loose constant. Figure 8 shows the ratio of the bound to the measured variance, median over pairs. It does not depend on m, but it ranges from about to in the unlabeled case and from to in the labeled case, and it grows with N. The bounds use the largest stopping weight , whereas a typical walk ends at a vertex of average weight. With our random v and w the ratio of the two grows slowly with N.
The tail bounds are correspondingly conservative (Figure 7). Hoeffding's bound (7) for a 10% error stays above 0.2 even at , while the measured frequency of such errors falls below already at . Table 2 compares the that guarantees a relative error of at most with probability according to (8) and (11) with the smallest of our grid that achieves it. The unlabeled bound overestimates the required budget by two to three orders of magnitude, and the labeled bound by four to five.
A.8 Choice of the label proposal q
In the labeled case the variance depends on the proposal through the importance weights (Section 3.3). We compare nine proposals on MUTAG, PTC_MR and AIDS with their edge labels. Let be the fraction of edges with label in the dataset and that fraction in graph . The proposals are uniform; for

Figure 8: Variance bound (6) or (9) divided by the measured variance, median over pairs. The bound is infinite for labeled graphs at .
Table 2: Budget needed for with , at : the smallest of the grid that achieves it, and the bound (8) or (11), median over pairs.
| case | |||||
|---|---|---|---|---|---|
| measured | bound | measured | bound | ||
| unlabeled | 0.3 | 100 | 300 | ||
| unlabeled | 0.7 | 300 | 1000 | ||
| labeled | 0.3 | 300 | 1000 | ||
| labeled | 0.7 | 1000 | 3000 | ||
; the average of over the graphs; and ; a random ; and as a deliberately poor control. Under a mean-field approximation, where at every vertex the mass of label is , the second moment per step is , minimized by . We use , , and 5 seeds, shared by all proposals. We report the relative MSE of the Gram entries against Direct, averaged over the seeds, and the Gram time (Figures 9 and 10).
The uniform proposal is never the most accurate. At and , proposals that follow the label frequencies reduce the relative MSE by a factor of 10 on MUTAG and 16 on AIDS. On PTC_MR only helps, by a factor of 3, while and are about twice worse than uniform. At every frequency-based proposal gains a factor of 3–6 on all three datasets. The inverse proposal is one to two orders of magnitude worse, as expected. The price is runtime. Uniform often samples labels that a graph does not contain or that are rare at the current vertex, and such walks end early. Frequency-based proposals keep walks alive, which makes the Gram computation 1.4–2.7 times slower (e.g. 71 s against 192 s on AIDS at for ). Even per unit of time they remain clearly better on MUTAG and AIDS. The mean-field optimum is the best proposal on AIDS at , but only sixth of nine there at and never the best on MUTAG or PTC_MR, where labels along a walk are correlated.
A.9 Number of label sequences per length
Section 3.3 predicts that for a fixed total budget the variance does not decrease with the number of label sequences per length, so that is optimal. For a fixed number of lengths , increasing reduces only the label-sampling part of the variance. We test both designs on MUTAG, PTC_MR and AIDS with

Figure 9: Relative MSE of the Gram matrix (top) and Gram time (bottom) for different label proposals , , averaged over 5 seeds.
uniform and 5 seeds: a fixed budget , and a fixed (Figures 11 and 12).
The runtime follows the design: it is constant in at a fixed budget and grows linearly with at a fixed (from 8.8 to 109 s on AIDS). At a fixed budget we see no systematic benefit of . At and the relative MSE stays between and for all , within the spread between seeds. At and , even gave a lower error than on MUTAG and AIDS. We attribute this to the heavy-tailed weights at . With a fixed and the error decreases with , by a factor of 6 to 15 at , without saturating in this range. Each additional sequence, however, costs as much as an additional length. Since increasing also reduces the length-sampling part of the variance, with a larger remains the simplest choice.
A.10 Effect of the decay parameter
We repeat the experiments for , while all other settings are as in Section 4. The synthetic setting uses pairs of graphs with vertices from the four families of Appendix A.3 and, in the labeled case, three edge labels, each drawn with probability . The reference is CG, since Direct is run only for

Figure 10: Same as Figure 9 for .
N < 128. The TU setting uses the full datasets. Its error is the mean relative error of the off-diagonal Gram entries against Direct, and its accuracy is the nested cross-validated SVC accuracy on the normalized Gram matrix. The constant c of MCRWK with m = cN is calibrated anew for every , so that its runtime stays matched to GVoys. Figure 13 shows the synthetic results, Figures 14 and 15 the TU results.
Runtime. Direct and Sylvester do not depend on . The iterative methods slow down as . FPI needs iterations, and its Gram time on unlabeled AIDS grows from to s, for it is the slowest method. CG depends on through the conditioning of and grows much less, from to s. Without labels, the cost of MCRWK at a fixed budget is roughly affine in the expected walk length . For it grows from 30 to 871 s on AIDS and from 0.035 to 0.90 s on a synthetic pair. With and , MCRWK is therefore slower than Direct on the small datasets MUTAG and PTC_MR, while remains faster on every dataset. With labels the cost grows much less, by at most a factor of three, and decreases slightly at . A labeled walk stops at the first step whose sampled label does not occur at the current vertex, so its length is limited by this stopping time rather than by the sampled length . GVoys and MCRWK with take a constant time.

Figure 11: Relative MSE (top) and Gram time (bottom) versus the number n of label sequences per length, for a fixed budget and for a fixed number of lengths , , averaged over 5 seeds.
Accuracy of the estimate without labels. Without labels, the relative error of MCRWK grows only mildly with . For it goes from 0.02, 0.006 and 0.002 at to 0.06, 0.019 and 0.006 at . These values are nearly the same on all four TU datasets and close to the synthetic ones, so the error is governed by and rather than by the graphs. The error of MCRWK with grows faster, from 0.001 to 0.017, because at a fixed time budget longer walks leave fewer samples: beyond its budget falls below . The error of GVoys is not monotone in . It rises from 0.09 to 0.16 at -0.7 and falls to 0.08 at . At equal runtime it stays more than an order of magnitude above MCRWK for every , by a factor of 12 to 106, and about 5 times above it at .
Accuracy of the estimate with labels. With labels, the error of MCRWK grows much faster. For it increases from about 0.003 at to 0.10 on AIDS and 0.15 on MUTAG and PTC_MR at , and to 0.023 on the synthetic pairs. With it reaches 0.3-0.5 on the TU datasets, which is worse than GVoys. This is the regime predicted by the variance bound of Section 3.3, which is finite only when . For the uniform proposal , where is the number of edge labels: for AIDS and the synthetic graphs, for MUTAG and PTC_MR. Beyond this threshold the importance weights along a walk become heavy-tailed, which slows the decay of the error. For large with labels, a proposal with larger or a larger budget is needed (Appendix A.8).
Classification. The SVC accuracy depends little on on most datasets. Without labels, the exact kernel does not exceed the fraction of the most frequent class on AIDS and MUTAG at any , and on ENZYMES and PTC_MR it stays within about two percentage points of it. MCRWK behaves the same at every budget. With labels, the exact kernel improves with on MUTAG (from 0.69 to 0.74) and on AIDS for (up to 0.85). MCRWK does not reproduce these gains: it stays between 0.66 and 0.71 on MUTAG and at 0.80 on AIDS. This matches its larger error at large in the labeled case. GVoys reaches up to 0.90 on AIDS, above

Figure 12: Same as Figure 11 for .
the exact kernel, in both cases. This gain comes from a size-dependent bias of the GVoys diagonal rather than from a closer approximation of the kernel (Appendix A.12). The biased diagonal of MCRWK gives the same picture.
A.11 Choice of the boundary vectors
The kernel depends on the starting and stopping vectors and . We compare three choices on the labeled datasets: normal (normalized draws, used in the other experiments), uniform (, used in Section 4.3) and degree ( proportional to the vertex degrees). All runs share the same three seeds, and the setup is otherwise that of Section 4.3.
The choice matters for every method. On ZINC_test, uniform and degree vectors are clearly better than normal ones: the exact kernel improves from 1.576 to 1.518 and 1.523, and MCRWK with from 1.692 to 1.590 and 1.577. The gap between MCRWK and the exact kernel also shrinks, from 0.116 with normal vectors to 0.072 with uniform and 0.054 with degree ones. Random boundary vectors add variation that the walk-based estimators must resolve, while uniform and degree vectors are smooth and are recovered from fewer walks.
On MUTAG the same ordering holds for the exact kernel (0.741, 0.761, 0.768), but not for the estimators: MCRWK with m = cN reaches 0.736 with uniform vectors and only 0.688–0.690 with the other two, and it exceeds GVoys (0.720) only with uniform vectors. On PTC_MR and AIDS no choice lifts any method above the constant predictor, and the Gram time differs by less than 5% between the three choices.
A.12 Supervised learning: all datasets and models
This section completes Section 4.3. It reports the labeled datasets PTC_MR and AIDS, the unlabeled case on all datasets, and three further models: the SVM on the PSD Gram matrix with the biased diagonal, kernel ridge regression on the Gram matrix, and ridge regression on the explicit features. The protocol is that of

MCRWK, m = cN MCRWK, m = 1000 MCRWK, m = 10000
Figure 13: Runtime and relative error of against for pairs of synthetic graphs with N = 256 vertices, without (top) and with (bottom) edge labels.
Section 4.3. Ridge is used as a classifier on one-hot targets, with the regularization parameter selected by the same nested cross-validation.
The SVM blocks use the uniform boundary vectors of the main text. The ridge runs and the whole unlabeled case were computed with normal vectors, and each heading in Table 4 states which. Appendix A.11 quantifies the difference, which is a few points of accuracy on MUTAG and about 0.07 of RMSE on ZINC_test. Comparisons between methods are made within a block, never across two blocks with different vectors. Table 5 lists the unlabeled results, and Figure 17 shows PTC_MR and AIDS against the Gram time.
Labeled PTC_MR and AIDS. On these datasets the exact kernel with SVC does not improve on the constant predictor. On PTC_MR every model stays between 0.52 and 0.57, around the majority class (0.558): the exact kernel reaches 0.547 and MCRWK with m = cN reaches 0.565, a difference of the order of the spread over the three seeds. On AIDS the exact kernel with SVC reaches exactly the majority class (0.800), and kernel ridge reaches 0.814. MCRWK gives 0.800 at every budget and with every model. The comparison between methods is therefore not informative on these two datasets, and we do not use them in the main text.
Unlabeled graphs. Without edge labels, no model of the exact kernel improves on the constant predictor on any dataset. On ZINC_test the RMSE is 1.99–2.00, the standard deviation of the target. This is a
Table 3: Accuracy (RMSE for ZINC_test) per choice of , labeled graphs, , mean over three seeds.
| Method | MUTAG | PTC_MR | AIDS | ZINC_test (RMSE) | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| normal | uniform | degree | normal | uniform | degree | normal | uniform | degree | normal | uniform | degree | |
| MCRWK, | 0.695 | 0.686 | 0.681 | 0.539 | 0.550 | 0.549 | 0.800 | 0.800 | 0.800 | 1.819 | 1.695 | 1.669 |
| MCRWK, | 0.676 | 0.688 | 0.683 | 0.549 | 0.540 | 0.558 | 0.800 | 0.800 | 0.800 | 1.724 | 1.617 | 1.598 |
| MCRWK, | 0.672 | 0.716 | 0.693 | 0.548 | 0.541 | 0.539 | 0.800 | 0.800 | 0.800 | 1.692 | 1.590 | 1.577 |
| MCRWK, | 0.690 | 0.736 | 0.688 | 0.531 | 0.565 | 0.547 | 0.800 | 0.800 | 0.800 | 1.674 | 1.590 | 1.577 |
| GVoys | 0.693 | 0.720 | 0.704 | 0.556 | 0.550 | 0.559 | 0.902 | 0.878 | 0.900 | 1.665 | 1.592 | 1.577 |
| Exact | 0.741 | 0.761 | 0.768 | 0.550 | 0.547 | 0.550 | 0.801 | 0.800 | 0.800 | 1.576 | 1.518 | 1.523 |
| Constant predictor | 0.665 | 0.665 | 0.665 | 0.558 | 0.558 | 0.558 | 0.800 | 0.800 | 0.800 | 1.988 | 1.988 | 1.988 |
property of the kernel, not of the estimators. With , and ,
The unlabeled kernel is therefore a weighted inner product of the scalar sequences , one number per walk length. Since is row-stochastic, for a connected, non-bipartite graph. The sequence is thus determined by a few short walks and by the boundary vectors. With uniform it is even constant, , and the normalized Gram matrix has all entries equal to one, this is why the unlabeled runs use normal vectors. Even then the sequences carry little structural information. With edge labels the kernel does not factorize: , and the features are indexed by label sequences, of which there are for walks of length . MCRWK reproduces the unlabeled results: at every budget its accuracy stays within two percentage points of the exact kernel and of the constant predictor.
Biased diagonal. The SVM on the PSD Gram matrix with the biased diagonal performs like the SVM on the unbiased estimate. Most differences are within the cross-validation noise, about . The exception is the small budget on ZINC_test, where the biased diagonal is clearly better: 1.654 against 1.695 for and 1.611 against 1.617 for , the gap closing to 0.002 at . This is consistent with its excess on the diagonal, which acts as an additional ridge and matters most when the estimate is noisiest. The biased Gram matrix needs no PSD correction and is exactly the Gram matrix of the features used by the linear models.
Ridge. Kernel ridge leads to the same conclusions as the SVM. On ZINC_test the exact kernel reaches an RMSE of 1.556, MCRWK reaches 1.810, 1.724 and 1.695 for and 1.677 for , so the ordering in is the one of the main text. On labeled MUTAG the exact kernel reaches 0.738 and MCRWK with reaches 0.707, or 0.718 on its features. Ridge on the features and kernel ridge on the biased-diagonal Gram matrix are the same model in primal and dual form. They agree to three decimals in all our runs, which numerically confirms that the features of MCRWK reproduce its Gram matrix.
GVoys on AIDS and NCI1. With SVC, GVoys reaches 0.878 on labeled AIDS and 0.873 on unlabeled AIDS, well above the exact kernel (0.800). It also reaches 0.576 against 0.516 on unlabeled NCI1. The linear SVM on its features gives the same values (0.881 and 0.571). The exact kernel stays at the level of the constant predictor, so this gain does not come from a closer approximation of the random walk kernel. It comes from graph size. On AIDS the two classes are separated by the number of vertices alone: every graph with fewer than 15 vertices belongs to one class, and an SVC on the vertex count reaches 0.997. The normalized kernel discards this information, but the GVoys diagonal is inflated by its own sampling variance, more for small graphs (by about 19% below 8 vertices and 2% above 30 on AIDS), and the normalization turns this bias into a size feature. Normalizing the same GVoys Gram matrix by the exact diagonal instead brings its accuracy on labeled AIDS (, normal ) from 0.89 back to 0.80. The gain is also specific to the hinge loss, since kernel ridge on the same GVoys Gram matrix and ridge on the same features give 0.800 on AIDS and 0.506 on NCI1. We therefore exclude these datasets from the comparison in the main text.
A.13 Effect of edge density
To separate the effect of the number of edges from that of the number of vertices, we fix and vary the edge probability of Erdos-Renyi graphs over , which takes the mean degree from about 13 to about 114. The remaining setup is that of the scaling experiment (Section 4.1): , normal starting and stopping vectors, three edge labels with probability each in the labeled case, and only of each pair is computed. The reference is CG. Direct, which the other experiments run only for , is included here at . It agrees with CG to a relative error below . The constant of MCRWK with is calibrated for every . Every point is the mean over 10 pairs, 3 for Direct, whose single pair takes about 4-6 minutes. They vary by up to a factor of 1.6 between neighbouring densities, uniformly across methods, so we compare methods only at the same . Figure 18 shows the results.
Runtime. The cost of the walk-based estimators does not depend on the density. Each step samples one neighbour, whatever the degree. The calibrated constant stays at –166 without labels and –106 with labels for every , and the runtimes of GVoys and of MCRWK at a fixed budget change only with the state of the machine. The iterative exact methods slow down as the graphs fill in: without labels, CG and FPI become 4 and 4.7 times slower from to . With labels the growth is smaller, because each label-specific adjacency matrix holds only a third of the edges. Direct takes 210–410 s for every , since the LU factors of the system fill in even for sparse graphs. At this size, however, CG, FPI and Sylvester need only to 0.12 s and remain faster than MCRWK with . The runtime advantage of MCRWK appears with the number of vertices (Section 4.1), not with the number of edges.
Error. The relative error of the estimators does not depend on the density either, as the variance bounds predict: they involve and but not the graph structure. Without labels, MCRWK has an error of 0.03–0.07, 0.010–0.026 and 0.004–0.009 for , and 0.002–0.005 for (). GVoys stays at 0.10–0.11 at the same runtime. With labels, MCRWK has 0.04–0.08, 0.017–0.029 and 0.011–0.014, and 0.009–0.013 for , against 0.065–0.09 for GVoys. The variation across is within the spread of the ten repetitions, and none of the curves shows a trend in .

Figure 14: Gram matrix time, relative error of the off-diagonal Gram entries against Direct, and SVC accuracy against on labeled TU datasets, median over three seeds. The exact methods compute the same kernel and reach the same accuracy, so only Direct is shown in the bottom row, the dotted line is the fraction of the most frequent class.

Figure 15: The same as Figure 14 for unlabeled TU datasets.

Figure 16: Prediction quality under three choices of the boundary vectors on labeled graphs (), constant predictor is dotted.

Figure 17: SVC accuracy against the time to build the Gram matrix on the labeled datasets PTC_MR and AIDS (, uniform ). Filled markers: kernel model on the Gram matrix; hollow markers: linear model on the explicit features of GVoys and MCRWK, at the Gram time of the same estimator. Dotted: the majority-class predictor.
Table 4: Labeled graphs, : accuracy (RMSE for ZINC_test) of every model, mean over three seeds. Exact stands for Direct, CG and FPI, which give the same kernel. Each heading names the boundary vectors used. The biased-diagonal Gram matrix of MCRWK is the inner product of its features, so ridge on the features coincides with kernel ridge on that matrix.
| Method | MUTAG | PTC_MR | AIDS | ZINC_test (RMSE) |
|---|---|---|---|---|
| SVM / SVR on the Gram matrix (uniform v, w) | ||||
| Exact | 0.761 | 0.547 | 0.800 | 1.518 |
| MCRWK, | 0.686 | 0.550 | 0.800 | 1.695 |
| MCRWK, | 0.688 | 0.540 | 0.800 | 1.617 |
| MCRWK, | 0.716 | 0.541 | 0.800 | 1.590 |
| MCRWK, | 0.736 | 0.565 | 0.800 | 1.590 |
| GVoys | 0.720 | 0.550 | 0.878 | 1.592 |
| SVM / SVR on the Gram matrix, biased diagonal (uniform v, w) | ||||
| MCRWK, | 0.686 | 0.549 | 0.800 | 1.654 |
| MCRWK, | 0.690 | 0.547 | 0.800 | 1.611 |
| MCRWK, | 0.718 | 0.543 | 0.800 | 1.588 |
| MCRWK, | 0.729 | 0.553 | 0.800 | 1.591 |
| GVoys | 0.720 | 0.550 | 0.878 | 1.592 |
| Linear SVM / SVR on the features (uniform v, w) | ||||
| MCRWK, | 0.695 | 0.548 | 0.800 | 1.649 |
| MCRWK, | 0.698 | 0.532 | 0.800 | 1.602 |
| MCRWK, | 0.715 | 0.545 | 0.800 | 1.582 |
| MCRWK, | 0.730 | 0.545 | 0.798 | 1.583 |
| GVoys | 0.721 | 0.552 | 0.881 | 1.582 |
| Kernel ridge on the Gram matrix (normal v, w) | ||||
| Exact | 0.738 | 0.536 | 0.814 | 1.556 |
| MCRWK, | 0.665 | 0.532 | 0.800 | 1.810 |
| MCRWK, | 0.676 | 0.522 | 0.800 | 1.724 |
| MCRWK, | 0.695 | 0.547 | 0.799 | 1.695 |
| MCRWK, | 0.707 | 0.547 | 0.800 | 1.677 |
| GVoys | 0.693 | 0.536 | 0.800 | 1.675 |
| Ridge on the features (normal v, w) | ||||
| MCRWK, | 0.700 | 0.536 | 0.800 | 1.804 |
| MCRWK, | 0.700 | 0.547 | 0.799 | 1.716 |
| MCRWK, | 0.692 | 0.554 | 0.800 | 1.684 |
| MCRWK, | 0.718 | 0.550 | 0.800 | 1.665 |
| GVoys | 0.693 | 0.536 | 0.800 | 1.675 |
| Constant predictor | 0.665 | 0.558 | 0.800 | 1.988 |
Table 5: The same as Table 4 without edge labels, with normal boundary vectors
| Method | MUTAG | PTC_MR | ENZYMES | AIDS | NCI1 | ZINC_test (RMSE) |
|---|---|---|---|---|---|---|
| SVM / SVR on the Gram matrix | ||||||
| Exact | 0.665 | 0.563 | 0.159 | 0.800 | 0.516 | 2.004 |
| MCRWK, m = 10² | 0.658 | 0.557 | 0.171 | 0.800 | 0.490 | 2.005 |
| MCRWK, m = 10³ | 0.665 | 0.548 | 0.162 | 0.800 | 0.497 | 2.005 |
| MCRWK, m = 10⁴ | 0.665 | 0.555 | 0.169 | 0.800 | 0.500 | 2.005 |
| MCRWK, m = cN | 0.660 | 0.551 | 0.168 | 0.800 | 0.507 | 2.005 |
| GVoys | 0.667 | 0.546 | 0.187 | 0.873 | 0.576 | 2.005 |
| SVM / SVR on the Gram matrix, biased diagonal | ||||||
| MCRWK, m = 10² | 0.665 | 0.558 | 0.186 | 0.800 | 0.495 | 2.005 |
| MCRWK, m = 10³ | 0.656 | 0.551 | 0.162 | 0.800 | 0.499 | 2.005 |
| MCRWK, m = 10⁴ | 0.665 | 0.548 | 0.179 | 0.800 | 0.502 | 2.005 |
| MCRWK, m = cN | 0.658 | 0.551 | 0.167 | 0.800 | 0.506 | 2.005 |
| Linear SVM / SVR on the features | ||||||
| MCRWK, m = 10² | 0.665 | 0.556 | 0.174 | 0.800 | 0.496 | 1.988 |
| MCRWK, m = 10³ | 0.665 | 0.546 | 0.163 | 0.800 | 0.501 | 1.988 |
| MCRWK, m = 10⁴ | 0.665 | 0.554 | 0.181 | 0.800 | 0.502 | 1.988 |
| MCRWK, m = cN | 0.660 | 0.545 | 0.161 | 0.800 | 0.500 | 1.988 |
| GVoys | 0.665 | 0.553 | 0.176 | 0.872 | 0.571 | 1.988 |
| Kernel ridge on the Gram matrix | ||||||
| Exact | 0.658 | 0.539 | 0.145 | 0.800 | 0.506 | 1.988 |
| MCRWK, m = 10² | 0.669 | 0.558 | 0.167 | 0.800 | 0.500 | 1.993 |
| MCRWK, m = 10³ | 0.665 | 0.548 | 0.155 | 0.799 | 0.508 | 1.990 |
| MCRWK, m = 10⁴ | 0.665 | 0.553 | 0.150 | 0.800 | 0.498 | 1.988 |
| MCRWK, m = cN | 0.665 | 0.545 | 0.173 | 0.800 | 0.502 | 1.988 |
| GVoys | 0.668 | 0.549 | 0.173 | 0.800 | 0.506 | 1.989 |
| Ridge on the features | ||||||
| MCRWK, m = 10² | 0.661 | 0.559 | 0.170 | 0.800 | 0.496 | 1.993 |
| MCRWK, m = 10³ | 0.661 | 0.552 | 0.168 | 0.800 | 0.501 | 1.989 |
| MCRWK, m = 10⁴ | 0.663 | 0.551 | 0.180 | 0.798 | 0.501 | 1.989 |
| MCRWK, m = cN | 0.663 | 0.548 | 0.155 | 0.799 | 0.506 | 1.988 |
| GVoys | 0.668 | 0.549 | 0.173 | 0.800 | 0.506 | 1.989 |
| Constant predictor | 0.665 | 0.558 | 0.167 | 0.800 | 0.500 | 1.988 |

MCRWK, m = cN MCRWK, m = 1000 MCRWK, m = 10000 GVoys FPI Direct CG Sylvester
Figure 18: Runtime and relative error of against the edge probability p of Erdos–Renyi graphs with N = 128 vertices, without and with edge labels, .