arXiv:2611.09189cs.LGNov 2026

Manuscript Offprint

arXiv:2611.09189

RoleWalk: training-free structural embeddings for directed graphs that transfer across graphs

Maixent Chenebaux

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Structural role embeddings describe a node by its position in a graph — hub, bridge, periphery, member of a dense core — rather than by who its neighbours are. Existing methods either learn coordinates specific to one graph (struc2vec, Role2Vec, RESD) or read scales and normalisations from the whole graph (GraphWave, Digraphwave), so the same neighbourhood can receive different coordinates in two graphs; few read edge directions. We present RoleWalk, a training-free embedding that follows a short lazy random walk from each node and records, at each step, two distributions: that of the transition probabilities, through its characteristic function at a fixed grid of frequencies, and that of the walker's distance to its starting node. On directed graphs, walks that go forward then backward add who shares a node's targets or sources. The embedding depends only on a node's neighbourhood within a fixed radius, so its coordinates mean the same thing in every graph. We show that, without curvature, it is the kernel mean embedding of the walk's footprint, that it separates graphs that the Weisfeiler–Leman test cannot, and that pruning small probabilities comes with a per-node error certificate. Empirically, RoleWalk is competitive with the best role embeddings on five classification benchmarks at a fraction of their cost, has the highest scores on real directed roles in Wikipedia adminship, exceeds the published accuracy of Digraphwave at every noise level of its own Enron network-alignment benchmark, transfers centrality predictors to graphs four times larger better than existing inductive embeddings, hand-made features and a trained GIN, and embeds a million nodes in 20s to 3 min on one CPU core. The code is open source (BSD license): https://github.com/kerighan/rolewalk.

1 Introduction

Two airports can play the same role — a regional hub feeding a national one — without sharing a single route. Structural embeddings capture this kind of similarity: nodes are close when their neighbourhoods look alike, wherever they are in the graph [4, 9, 19]. They are used for role discovery, for network alignment, where a node must be recognised in a second graph [3, 7], and as positional or structural encodings in graph neural networks and graph transformers [5, 18].

Three properties matter in these uses, and current methods rarely combine them. Transfer: for alignment, or for a model trained on one graph and applied to another, a coordinate must mean the same thing in every graph. Methods that fit a skip-gram model or an autoencoder per graph [1, 19, 27] produce coordinates that are only defined up to that fit; GraphWave [4] averages over all nn nodes and picks its diffusion scale from each graph's spectrum, so identical neighbourhoods in graphs of different sizes get different coordinates. Directions: in a vote, a citation or an email, who points to whom is part of the role, yet most role embeddings drop directions. Cost: in our benchmarks, learned and diffusion methods take seconds to minutes on graphs of a thousand nodes, and most do not run at a hundred thousand within an hour or 16 GB.

RoleWalk starts from a simple observation. After ww steps of a random walk from node uu, two things characterise uu's position: how concentrated the walk is (a hub spreads its mass thinly, a leaf keeps most of it) and how far it has gone (a node in a triangle-rich region keeps returning near its start). RoleWalk encodes both, at each of a few steps, with fixed functions that need no training and no graph-level quantity.