SWING: Unlocking Implicit Graph Representations for Graph Random Features

Alessandro Manenti, Avinava Dubey, Arijit Sehanobish, Cesare Alippi, Krzysztof Choromański

Abstract

We propose SWING: Space Walks for Implicit Network Graphs, a new class of algorithms for computations involving Graph Random Features on graphs given by implicit representations (i-graphs), where edge-weights are defined as bi-variate functions of feature vectors in the corresponding nodes. Those classes of graphs include several prominent examples, such as: $\epsilon$-neighborhood graphs, used on regular basis in machine learning. Rather than conducting walks on graphs' nodes, those methods rely on walks in continuous spaces, in which those graphs are embedded. To accurately and efficiently approximate original combinatorial calculations, SWING applies customized Gumbel-softmax sampling mechanism with linearized kernels, obtained via random features coupled with importance sampling techniques. SWING relies on the deep connection between implicitly defined graphs and Fourier analysis. SWING is accelerator-friendly and does not require input graph materialization. We provide detailed analysis of SWING and complement it with thorough experiments on different classes of i-graphs.

Introduction

Graph kernels are powerful tools for capturing relational data, but computing them exactly is computationally expensive, often scaling at $O(N^3)$ or worse. Recently, Graph Random Features (GRFs) addressed this by using random walks to approximate the kernel matrix in sub-quadratic time. However, GRFs typically require an explicit graph—a materialized adjacency matrix—to conduct these random walks.

In many modern machine learning applications, such as 3D point cloud modeling or Vision Transformers, graphs are implicit. Edge weights are functions of node features (e.g., spatial distance). Building an explicit graph from these relationships takes $O(N^2)$ time and memory. Furthermore, the discrete, combinatorial nature of traditional random walks is unfriendly to modern hardware accelerators (GPUs/TPUs), which prefer dense matrix multiplications. SWING (Space Walks for Implicit Network Graphs) introduces a highly efficient way to compute GRFs on these implicit graphs without ever materializing the memory-heavy $O(N^2)$ adjacency matrix, achieving linear-time $O(N)$ scalability.

Methodology

To bypass graph materialization, SWING shifts the paradigm from walking on discrete nodes to walking in the continuous $d$-dimensional space where the nodes are embedded.

Overview of the SWING architecture: transitioning from discrete graph walks to continuous space walks using Gumbel-softmax and Random Features.

Key components of the SWING framework include:

  • Continuous Space Walks: Instead of hopping between nodes, the "walker" transitions to a new coordinate in continuous space, calculated as a convex combination of node positions.
  • Gumbel-Softmax Relaxation: This trick makes the discrete choice of the next node visit differentiable and continuous.
  • Random Features (RFs): SWING uses Random Features to linearize transition probabilities, decoupling pairwise interactions and avoiding the $O(N^2)$ bottleneck.
  • Fréchet Noise Factorization: Leveraging the Mellin transform, the authors factorize the noise distribution into independent linear components for efficient sampling.
  • Relaxed Load Computation: The walker "smears" its scalar load across all vertices based on their distance to its current continuous position, rather than depositing it at a single discrete node.

Key Results and Evaluation

The authors evaluated SWING across synthetic 3D point clouds, the Thingi10K mesh dataset, and standard image benchmarks (ImageNet and Places365).

SWING achieves over an order of magnitude speedup during inference compared to standard GRFs. As shown in the performance analysis, SWING traces a strictly better Pareto-optimal frontier for accuracy (measured by Frobenius Norm Error) versus computation time across various graph sizes.

Pareto frontier comparing SWING to CPU and GPU baselines: SWING achieves lower error in significantly less time.

Beyond speed, SWING demonstrates superior scalability, reducing the complexity of implicit graph operations from $O(N^2)$ to $O(N)$. On the Thingi10K dataset for vertex normal prediction, SWING matches the accuracy of standard GRFs while scaling significantly better. Furthermore, when integrated into a Vision Transformer (ViT) to inject implicit grid-graph topology, SWING improved Top-1 accuracy on ImageNet (80.10% to 80.34%) and Places365 (55.78% to 55.97%) with negligible overhead.

Conclusion

SWING provides a hardware-sympathetic approach to graph kernels by converting discrete walks into continuous, attention-like dense matrix multiplications. While it requires kernel functions to be amenable to Random Feature approximation and involves hyperparameter tuning (e.g., Gumbel temperature), its success in Vision Transformers suggests broad applicability. Future work may involve applying these implicit graph topological masks to other Transformer-based architectures, such as Large Language Models or 3D-Transformers.

Summary updated

BibTeX
@inproceedings{manenti2026swing,
  author = {Alessandro Manenti and Avinava Dubey and Arijit Sehanobish and Cesare Alippi and Krzysztof Choromański},
  title = {{SWING: Unlocking Implicit Graph Representations for Graph Random Features}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=LBcnybFVBp},
}
Figure