Papers › Transformers Meet Directed Graphs

Transformers Meet Directed Graphs

31 Jan 2023arXiv:2302.00049archive 2025-07-28

Simon Geisler, Yujia Li, Daniel Mankowitz, Ali Taylan Cemgil, Stephan Günnemann, Cosmin Paduraru

Transformers were originally proposed as a sequence-to-sequence model for text but have become vital for a wide range of modalities, including images, audio, video, and undirected graphs. However, transformers for directed graphs are a surprisingly underexplored topic, despite their applicability to ubiquitous domains, including source code and logic circuits. In this work, we propose two direction- and structure-aware positional encodings for directed graphs: (1) the eigenvectors of the Magnetic Laplacian - a direction-aware generalization of the combinatorial Laplacian; (2) directional random walk encodings. Empirically, we show that the extra directionality information is useful in various downstream tasks, including correctness testing of sorting networks and source code understanding. Together with a data-flow-centric graph construction, our model outperforms the prior state of the art on the Open Graph Benchmark Code2 relatively by 14.7%.

PaperPDFCode

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

Code

deepmind/digraph_transformer officialmentioned in paperjaxNOASSERTION report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Graph Property Predictiongraph construction

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Graph Property Prediction ogbg-code2 SAT++ with Magnetic Laplacian Ext. data No #1 of 21 Archive leaderboard report
Graph Property Prediction ogbg-code2 SAT++ with Magnetic Laplacian Number of params 14378069 #1 of 21 Archive leaderboard report
Graph Property Prediction ogbg-code2 SAT++ with Magnetic Laplacian Test F1 score 0.2222 ± 0.0010 #1 of 21 Archive leaderboard report
Graph Property Prediction ogbg-code2 SAT++ with Magnetic Laplacian Validation F1 score 0.2044 ± 0.0020 #1 of 21 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections