Simple Path Structural Encoding for Graph Transformers

Louis Airale, Antonio Longa, Mattia Rigon, Andrea Passerini, Roberto Passerone
2/14/2026

No official code found. Best implementation: LouisBearing/Graph-SPSE-Encoding (4 stars, last commit 2026-03-13).

Abstract

Graph transformers extend global self-attention to graph-structured data, achieving notable success in graph learning. Recently, random walk structural encoding (RWSE) has been found to further enhance their predictive power by encoding both structural and positional information into the edge representation. However, RWSE cannot always distinguish between edges that belong to different local graph patterns, which reduces its ability to capture the full structural complexity of graphs. This work introduces Simple Path Structural Encoding (SPSE), a novel method that utilizes simple path counts for edge encoding. We show theoretically and experimentally that SPSE overcomes the limitations of RWSE, providing a richer representation of graph structures, particularly for capturing local cyclic patterns. To make SPSE computationally tractable, we propose an efficient approximate algorithm for simple path counting. SPSE demonstrates significant performance improvements over RWSE on various benchmarks, including molecular and long-range graph datasets, achieving statistically significant gains in discriminative tasks. These results pose SPSE as a powerful edge encoding alternative for enhancing the expressivity of graph transformers.

View on arXivView PDF

Code Implementations(1)

The minimal reproducible code to count simple paths in a graph in python

40PythonFeb 13, 20257 months ago

Similar Papers

Cite this paper

@article{airale2026simple,
  title  = {Simple Path Structural Encoding for Graph Transformers},
  author = {Louis Airale and Antonio Longa and Mattia Rigon and Andrea Passerini and Roberto Passerone},
  year   = {2026},
  eprint = {2502.09365},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2502.09365},
  journal = {ICML 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.09365.svg)](https://codeofpaper.com/paper/2502.09365)

Discussion