Skip to content

Menu

WorksComputer Science

Path Laplacian Encodings for Directed Graphs

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_e6dj7ks7. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Directed graphs naturally model many real-world systems in which interactions are asymmetric, such as citation networks, web graphs, and information-flow networks. However, graph learning methods commonly rely on message passing with symmetrized graph representations or positional encodings that only partially exploit edge directionality. We introduce PathLapPE, a novel spectral positional encoding (PE) derived from the path Laplacian on directed graphs. PathLapPE provides node- and edge-level features that encode directional higher-order structure and can be incorporated into standard graph learning architectures. Empirical results on node- and graph-level benchmark tasks show that PathLapPE yields consistent improvements across several architectures, especially when combined with direction-aware message passing. Compared with magnetic Laplacian positional encodings, a widely studied spectral positional encoding for directed graphs, PathLapPE does not require additional fine-tuning of directionality hyperparameters while offering competitive runtime and performance.

Introduction

Many real-world relational systems are naturally represented by directed graphs: citations point from one document to another, hyperlinks encode navigation, circuits and programs contain logical dependencies, and biological or transportation networks often involve intrinsically asymmetric interactions. In such settings, edge orientation is not a secondary attribute but an integral part of the semantic content of the data. Nevertheless, a large fraction of graph neural network architectures either assume undirected graphs or preprocess directed graphs by replacing each directed edge with an undirected one. This naive symmetrization can destroy key information for downstream tasks.

Several approaches have been proposed to incorporate directionality into graph learning architectures. These include modifying message passing so that information flowing along incoming and outgoing edges is processed differently (Dir-GNN, Rossi et al., 2024), utilizing directed Laplacians (MagNet, Zhang et al., 2021), and injecting directed information through positional or structural encodings (PSE), attention biases, or edge features ([7, 12]).

Positional and structural encodings have become central tools in modern graph learning by enriching node and edge representations ([4, 2, 11]). Positional encodings typically aim to distinguish where nodes lie in the graph, for instance through Laplacian eigenvectors, random-walk features, distances, or resistance-based quantities. Structural encodings, in contrast, describe the role or local environment of a node or edge, such as degrees, orbit counts, local subgraph statistics, or other invariants.

Despite substantial progress on positional encodings for undirected graphs, direction-aware positional encodings remain comparatively underdeveloped. Existing directed encodings include directed walk encodings ([7]), walk profiles ([12]), and magnetic Laplacian encodings ([7, 12]). These methods have demonstrated that direction-aware encodings can significantly improve the expressivity of graph Transformers and GNNs on tasks where orientation matters. However, magnetic-Laplacian-based encodings also come with practical limitations. Their behavior is sensitive to the choice of the magnetic phase parameter qq, and strong performance often requires either careful tuning of this parameter or the concatenation of encodings associated with several values of qq. While multi-qq constructions improve the ability of magnetic encodings to represent directed walk patterns, they also require several complex-valued spectral decompositions and increase the size of the resulting positional encoding. This creates a trade-off between directional expressivity and computational simplicity.

In this work, we propose PathLapPE, a positional encoding for directed graphs constructed from the path Laplacians of the directed path complex. Instead of encoding direction through complex phases, PathLapPE uses the algebraic structure of directed paths to produce real-valued node- and edge-level spectral features. Our contributions are as follows:

  1. We introduce PathLapPE, a spectral PE derived from the path complex of a directed graph. It provides node- and edge-level features, with the latter encoding both edge orientation and directed 2-path structure. Unlike magnetic Laplacian PEs, it requires no phase parameter tuning or multi-qq stacking. It can be easily incorporated into standard GNN and graph Transformer architectures. To the best of our knowledge, this is the first direction-aware positional encoding for graph learning based on the path Laplacian.

  1. We introduce EdgeSPE, an extension of SPE (Huang et al., [11]) to edge-level encodings, which allows for performance gains with edge-level PathLapPE features.

  1. We show that PathLapPE captures directionality and consistently matches or outperforms other spectral PEs on an array of node- and graph-level directed benchmarks across several GNN architectures, with the largest gains for direction-aware models such as bidirectional and edge-gated GNNs.

Related Work

Bidirectional graph neural networks. Classical message passing neural networks (MPNNs) update node representations by aggregating features from local neighborhoods. Architectures such as GCN (Kipf & Welling, [15]), GAT (Veličković et al., 2018), and GIN (Xu et al., 2019) differ in their choices of aggregation and update functions and usually assume an undirected graph or operate on a symmetrized version of the input. This can be problematic for directed graphs, where incoming and outgoing edges may encode different types of relationships.

Recent work has therefore proposed message passing schemes that explicitly preserve edge orientation. Bidirectional (or directed) GNN adapts standard message passing architectures to directed graphs by aggregating messages from in-neighbors and out-neighbors separately (Jaume et al., [13]; Huang et al., [12]; Rossi et al., 2024). Given a graph G=(V,E⃗)G = (V, \vec{E}) and node features {hv}v∈V\{h_v\}_{v \in V}, the features for the next layer {hv}v∈V\{h_v\}_{v \in V} after message passing can be written as

hv′=αψin(hv,AGG⁡u∈Nin(v)ϕin(hu,hv))+(1−α)ψout(hv,AGG⁡u∈Nout(v)ϕout(hu,hv)),h'_v = \alpha\psi_{\mathrm{in}}\left(h_v,\operatorname{AGG}_{u \in\mathcal{N}_{\mathrm{in}}(v)} \phi_{\mathrm{in}}(h_u,h_v)\right) + (1-\alpha)\psi_{\mathrm{out}}\left(h_v,\operatorname{AGG}_{u \in\mathcal{N}_{\mathrm{out}}(v)} \phi_{\mathrm{out}}(h_u,h_v)\right),

where the α\alpha parameter controls the weight assigned to each direction. Other directed or edge-aware variants, including GAT- and GIN-type architectures with edge features, can also exploit orientation-dependent information when it is made available through the input representation. Our work is complementary to these architectural approaches: rather than modifying the message passing scheme, we construct direction-aware spectral features that encode higher-order relations that these message passing schemes can better leverage.

Spectral and directed positional encodings. Positional encodings enrich node or edge representations with information about their location in the graph. Spectral positional encodings are commonly obtained from eigenvectors of a graph operator, most often the Laplacian. Given a Laplacian LL, a kk-dimensional Laplacian positional encoding (LapPE) assigns to each node vv the vector PE(v)=(u1(v),…,uk(v))\mathrm{PE}(v) = (u_1(v),\ldots,u_k(v)), where u1,…,uku_1,\ldots,u_k are the first kk eigenvectors of LL (i.e., those corresponding to the smallest eigenvalues). These encodings capture global geometric information that may not be available to purely local message passing layers. However, Laplacian eigenvectors come with sign and basis ambiguities: each eigenvector is defined only up to sign, and eigenspaces associated with repeated eigenvalues are defined only up to a change of orthonormal basis. This has motivated invariant and equivariant approaches to spectral encodings, such as SignNet, BasisNet [16], and SPE [11].

For directed graphs, positional encodings must also account for edge orientation. Existing approaches include directed walk profiles and magnetic-Laplacian-based encodings. The magnetic Laplacian is a complex Hermitian operator whose phases encode edge direction, and it has been used both in directed spectral neural architectures such as MagNet and as a source of direction-aware positional encodings [7] (Zhang et al. 2021). Recent multi-qq magnetic Laplacian (Multi-qq-MagLapPE) encodings concatenate spectral features obtained from several choices of the magnetic phase parameter qq, improving the ability to represent directed walk profiles [12]. This additional expressivity, however, comes with the need to tune, compute, and store several complex-valued spectral decompositions and increases the size of the resulting encoding.

Our method, PathLapPE, is similar in spirit to these magnetic approaches but differs in its underlying Laplacian. Instead of encoding orientation through complex phases, it uses the path Laplacians associated with the directed path complex [8]. This yields real-valued encodings that can be used at both the node and edge levels.

Path complexes and directed motifs in graph learning.

Higher-order directed structure has entered graph learning in two main ways. MotifNet [18] defines convolutions from symmetric node-level Laplacians of a predefined set of directed motifs, without lifting the graph. A second line of work lifts the graph to a path complex (Truong & Chin, 2024)1, and runs message passing on that domain, in analogy with simplicial and cellular architectures. However, such higher-order message-passing schemes are computationally expensive due to the processing of higher-order tensors [17], and the theoretical expressivity guarantees provided by higher-order MPNNs typically fail to account for the practical limitations of GNNs, leading only to modest performance gains at a significant computational cost [14].

Our approach differs from both. PathLapPE does not require choosing motifs, as directed higher-order structures arise naturally from the boundary maps of the path complex. In contrast to lifted architectures, we use the path Laplacian only to compute node- and edge-level positional encodings; the downstream model then runs standard message passing on the original graph, so it receives directional and higher-order information from the path complex without the cost of higher-order message passing.

From directed graphs to positional encodings

Path Laplacian

Path Laplacians are a family of Laplace-type operators for directed graphs, derived from the boundary maps of the path complex. We briefly recall here the construction of path complexes and path Laplacians associated with directed graphs, and refer the reader to Grigor’yan [8] and Grigor’yan et al. [9] for more details.

We consider a directed graph G=(V,E⃗)G = (V,\vec{E}) and assume throughout that GG has no self-loops. An elementary pp-path on VV is an ordered sequence of vertices v0v1…vpv_0v_1\ldots v_p, where repetitions are allowed (and we do not require that (vi,vi+1)∈E⃗(v_i,v_{i+1}) \in\vec{E}). We call a pp-path any finite formal sum σ=∑v0,…,vp∈Vλv0…vp v0…vp\sigma= \sum_{v_0,\ldots,v_p \in V} \lambda_{v_0\ldots v_p}\,v_0\ldots v_p, with coefficients λv0…vp∈R\lambda_{v_0\ldots v_p} \in\mathbb{R}. We define the vector space Λp\Lambda_p as the space of all pp-paths where elements of the form viviv_i v_i are identified with the zero vector. An elementary pp-path v0v1…vpv_0v_1\ldots v_p is called allowed if (vi,vi+1)(v_i,v_{i+1}) is a directed edge in E⃗\vec{E} for all 0≤i≤p−10 \leq i \leq p-1. We denote by Ap\mathcal{A}_p the vector space spanned by the allowed pp-paths. For any p>0p > 0, we define the boundary map ∂p:Λp→Λp−1\partial_p:\Lambda_p \to\Lambda_{p-1} by first defining

∂p(v0…vp)=∑k=0p(−1)kv0…vk−1vk+1…vp,(1)\partial_p(v_0\ldots v_p) = \sum_{k=0}^{p} (-1)^k v_0\ldots v_{k-1}v_{k+1}\ldots v_p, \tag*{(1)}

for elementary pp-paths and then extending ∂p\partial_p to all of Λp\Lambda_p by linearity. We set Λ−1=A−1={0}\Lambda_{-1} = A_{-1} = \{0\} to be the zero vector space and let ∂0:Λ0→Λ−1\partial_0 : \Lambda_0 \to\Lambda_{-1} be the zero map. These maps satisfy ∂p−1∘∂p=0\partial_{p-1} \circ\partial_p = 0, and therefore define a chain complex (see Grigor’yan et al. [10])

⋯→∂p+1Λp→∂pΛp−1→∂p−1⋯\cdots\xrightarrow{\partial_{p+1}} \Lambda_p \xrightarrow{\partial_p} \Lambda_{p-1} \xrightarrow{\partial_{p-1}} \cdots

Example 1. Consider the directed triangle graph shown in Figure 1(a). The graph consists of three vertices or 00-paths aa, bb, and cc. Any ordered sequence of the vertices defines an elementary path, for instance, the ordered pair caca is an elementary 11-path. However, caca is not an allowed path because (c,a)∉E⃗(c, a) \notin\vec{E}. This graph has exactly three allowed 11-paths corresponding to the three edges in E⃗\vec{E}, u:=abu := ab, v:=bcv := bc, and w:=acw := ac. The only allowed 22-path is given by t:=abct := abc, which can be obtained by concatenating the directed edges (a,b)(a, b) and (b,c)(b, c). To understand the definition of A1A_1, we observe that uu and vv are allowed 11-paths and so the (non-elementary) 11-path defined by u+2vu + 2v is an element of A1A_1, the vector space spanned by allowed 11-paths, even though it is not itself an allowed 11-path.

Figure 1. Basis elements of Ω2\Omega_2: invariant elementary 2-paths in (a) and (c), and the difference of the solid and dashed 2-paths in (b).

The following example illustrates that, in general, the boundary of an allowed path is not necessarily an allowed path and that the spaces ApA_p do not necessarily form a chain complex.

Example 2. Consider the directed path graph with three vertices, V={a,b,c}V = \{a, b, c\} and two edges, E⃗={(a,b),(b,c)}\vec{E} = \{(a, b), (b, c)\} (shown as a subgraph in Figure 1(a)). Then, the 22-path abcabc is an allowed path and, by definition, ∂2(abc)=bc−ac+ab\partial_2(abc) = bc - ac + ab. However, acac is not an allowed 11-path and there is no way to write ∂2(abc)\partial_2(abc) as a linear combination of the allowed paths. Thus, ∂2(abc)∉A1\partial_2(abc) \notin A_1.

In order to obtain a chain complex, one considers the subspace Ωp\Omega_p of ∂\partial-invariant allowed paths,

Ωp={σ∈Ap:∂p(σ)∈Ap−1}.(2)\Omega_p = \{\sigma\in A_p : \partial_p(\sigma) \in A_{p-1}\}. \tag*{(2)}

In this paper, we will mostly be interested in the vector space Ωp\Omega_p and so, unless otherwise stated, the boundary maps will always refer to the linear maps ∂p:Ωp→Ωp−1\partial_p : \Omega_p \to\Omega_{p-1} obtained by restricting the boundary maps in Equation (1) (denoted by the same symbol in a minor abuse of notation). We equip each Λp\Lambda_p with the standard inner product for which the elementary pp-paths form an orthonormal basis, and we equip Ωp⊂Λp\Omega_p \subset\Lambda_p with the induced inner product. The adjoint of the boundary map ∂p:Ωp→Ωp−1\partial_p : \Omega_p \to\Omega_{p-1} is denoted by ∂p∗:Ωp−1→Ωp\partial_p^* : \Omega_{p-1} \to\Omega_p. The pp-path Laplacian is defined by Lp=∂p+1∂p+1∗+∂p∗∂pL_p = \partial_{p+1}\partial_{p+1}^* + \partial_p^*\partial_p. Equivalently, if BpB_p denotes the matrix representation of ∂p\partial_p, then, in an orthonormal basis, the pp-path Laplacian has the matrix representation (also denoted LpL_p in a minor abuse of notation)

Lp=Bp+1Bp+1T+BpTBp.(3)L_p = B_{p+1}B_{p+1}^{\mathsf{T}} + B_p^{\mathsf{T}}B_p. \tag*{(3)}

The first term Bp+1Bp+1TB_{p+1}B_{p+1}^{\mathsf{T}} is called the up Laplacian, while the second term BpTBpB_p^{\mathsf{T}}B_p is called the down Laplacian. Furthermore, unlike magnetic-Laplacian constructions, the path Laplacian is obtained directly from the directed path structure of the graph and does not require the choice of an additional phase parameter. Moreover, because the operator acts on spaces of directed paths, it naturally produces spectral information at different orders. A fully worked example is provided in Example 3 (Appendix C).

Path Laplacian PEs

In this work, for computational efficiency, we construct path complexes up to path length p=2p = 2. The corresponding path Laplacians provide spectral information at both the vertex and edge levels: the 00-path Laplacian L0L_0 acts on vertices and is used to define node-level positional encodings, whereas the 11-path Laplacian L1L_1 acts on directed edges and is used to define edge-level positional encodings. An explicit formula for L0L_0 is given by

L0(u,v)=D(u,v)−(A(u,v)+A(v,u)),L_0(u,v) = D(u,v) - (A(u,v) + A(v,u)),

where DD is the diagonal degree matrix associated with A+ATA + A^{\mathsf{T}}, and AA is the adjacency matrix defined by A(u,v)=1A(u,v) = 1 if (u,v)∈E⃗(u,v) \in\vec{E}, and zero otherwise. We note that if GG has no bidirectional edges, then L0L_0 is equal to the traditional (combinatorial) graph Laplacian on the symmetrized graph associated with GG (constructed by placing an (undirected) edge between uu and vv if (u,v)∈E⃗(u,v) \in\vec{E} or (v,u)∈E⃗(v,u) \in\vec{E}). Moreover, the edge Laplacian is given by

L1=B2B2T+B1TB1.(4)L_1 = B_2B_2^{\mathsf{T}} + B_1^{\mathsf{T}}B_1. \tag*{(4)}

The edge-level operator incorporates both incidence information through the down Laplacian and directed two-step path information through the up Laplacian. These encodings can then be incorporated into graph neural networks or graph Transformers as additional structural features, allowing the model to access directional higher-order information beyond the symmetrized adjacency structure.

Beyond edge directionality. We highlight here a feature of the path Laplacian that makes it a natural backbone for extracting positional encodings. As discussed above, two-step relations are encoded in the edge Laplacian L1\mathbf{L}_1 through the up-Laplacian term B2B2T\mathbf{B}_2\mathbf{B}_2^{\mathsf{T}}; see Equation (4). Moreover, Grigor’yan et al. [9] shows that the space Ω2\Omega_2 of ∂\partial-invariant allowed 2-paths admits a basis spanned by the directed motifs in Figure 1. Thus, when the boundary map ∂2:Ω2→Ω1\partial_2:\Omega_2 \to\Omega_1 is represented in such a basis, the matrix B2\mathbf{B}_2 encodes the incidence relations between edges and directed 2-path motifs. Although we do not explicitly fix this basis in practice, this perspective suggests that the up Laplacian B2B2T\mathbf{B}_2\mathbf{B}_2^{\mathsf{T}} captures structural information beyond edge directionality alone.

A basis for Ω2\Omega_2. The space of pp-paths admits a decomposition Λp=Ap⊕Dp\Lambda_p = A_p \oplus D_p into the direct sum of ApA_p and the vector space DpD_p spanned by the non-allowed elementary pp-paths. Then, for any p≥1p \ge1, the restriction of the boundary map defined in Eq. (1) to the space of allowed paths ∂p:Ap→Λp−1\partial_p:A_p \to\Lambda_{p-1} can be expressed as a sum of two maps ∂p=∂pA+∂pD\partial_p = \partial_p^A + \partial_p^D defined by ∂pA=πp−1A∘∂p\partial_p^A = \pi_{p-1}^A \circ\partial_p, and ∂pD=πp−1D∘∂p\partial_p^D = \pi_{p-1}^D \circ\partial_p, where πp−1A\pi_{p-1}^A and πp−1D\pi_{p-1}^D denote the projection maps onto Ap−1A_{p-1} and Dp−1D_{p-1}, respectively. The vector space of ∂\partial-invariant paths is precisely Ωp=ker⁡∂pD\Omega_p = \ker\partial_p^D. The matrix representation Bp\mathbf{B}_p of the restricted boundary map ∂p:Ωp→Ωp−1\partial_p:\Omega_p \to\Omega_{p-1} depends on choices of bases for Ωp\Omega_p, and Ωp−1\Omega_{p-1}. Constructing such bases is a key step in the construction of the path Laplacian in Equation (3).

In general, computing a kernel basis for large matrices can be time-consuming. However, since we are mainly interested in the case p≤2p \le2, this can be significantly simplified. The following theorem provides an explicit basis for the space of ∂\partial-invariant paths Ω2\Omega_2. Algorithm 1, which implements this construction, is provided in Appendix C. We note that unlike the basis obtained by Grigor’yan et al. [9], our basis is orthonormal which allows for efficient numerical implementation.

Theorem 1. Consider a directed graph GG with vector space of allowed 2-paths A2A_2. Let BA(2)\mathcal{B}_A^{(2)} denote the basis of A2A_2 formed by all elementary allowed 2-paths. Then Ω2\Omega_2 admits an orthonormal basis consisting of the ∂\partial-invariant elementary 2-paths σ∈BA(2)\sigma\in\mathcal{B}_A^{(2)}, together with vectors of the form

hℓ=1ℓ(ℓ+1)(∑q=1ℓσq−ℓσℓ+1),(5)\mathbf{h}_{\ell} = \frac{1}{\sqrt{\ell(\ell+1)}}\left(\sum_{q=1}^{\ell}\sigma_q - \ell\sigma_{\ell+1}\right), \tag*{(5)}

for ℓ=1,…,m−1\ell= 1,\ldots,m-1, where, for each non-allowed elementary 1-path τ\tau, σ1,…,σm\sigma_1,\ldots,\sigma_m is a fixed ordering of all elementary allowed 2-paths satisfying ∂2D(σq)=−τ\partial_2^D(\sigma_q) = -\tau.

Theorem 1 allows an efficient construction of the boundary matrix B2\mathbf{B}_2, hence of the path Laplacian.

EdgeSPE: Sign- and basis-invariant edge-level Path Laplacian PEs

In this section, we briefly review Stable and Expressive Positional Encodings (SPE), an effective encoding strategy introduced in Huang et al. [11] to make spectral PEs sign- and basis-invariant. Standard SPE was developed for node-level encodings and therefore cannot be directly applied to the edge-level PathLapPE encodings corresponding to L1\mathbf{L}_1 without suitable modifications. We therefore develop a modified method, EdgeSPE, which extends SPE to edge-level encodings.

Let V∈Rn×d\mathbf{V} \in\mathbb{R}^{n \times d} be a matrix containing the first dd eigenvectors of a Laplacian matrix L\mathbf{L} and letting λ∈Rd\boldsymbol{\lambda} \in\mathbb{R}^{d} denote a vector of the corresponding eigenvalues, the original SPE is defined by

SPE⁡(V,λ)=ρ(Vdiag⁡(ϕ1(λ))VT,…,Vdiag⁡(ϕm(λ))VT),(6)\operatorname{SPE}(\mathbf{V},\boldsymbol{\lambda}) = \rho\left(\mathbf{V}\operatorname{diag}(\phi_1(\boldsymbol{\lambda}))\mathbf{V}^{\mathsf{T}},\ldots,\mathbf{V}\operatorname{diag}(\phi_m(\boldsymbol{\lambda}))\mathbf{V}^{\mathsf{T}}\right), \tag*{(6)}

where ρ:Rn×n×m→Rn×p\rho: \mathbb{R}^{n \times n \times m} \to\mathbb{R}^{n \times p} and each of the ϕℓ:Rd→Rd\phi_\ell: \mathbb{R}^{d} \to\mathbb{R}^{d} are permutation equivariant functions. Intuitively, the ϕℓ\phi_\ell act as a soft, learnable partition of the spectrum, in contrast to the hard partition into eigenspaces used by BasisNet [16]. See Appendix § 12 for further discussion.

EdgeSPE for PathLapPE. To extend SPE to the edge-level setting, we let U∈R∣E∣×dU \in\mathbb{R}^{|E| \times d} be a matrix containing the first dd eigenvectors of L1L_1 and let λ(1)∈Rd\lambda^{(1)} \in\mathbb{R}^{d} denote a vector of the corresponding eigenvalues. Analogously to the kernels Vdiag⁡(ϕi(λ))V⊤V\operatorname{diag}(\phi_i(\lambda))V^\top, used in the original SPE (see Eq. (6)), we form edge-level SPE kernels Ki=Udiag⁡(ϕi(λ(1)))U⊤∈R∣E∣×∣E∣K_i = U\operatorname{diag}(\phi_i(\lambda^{(1)}))U^\top\in\mathbb{R}^{|E| \times|E|}, where 1≤i≤m1 \le i \le m. For each edge ee, we let S(e)={f:tail⁡(f)=head⁡(e)}S(e) = \{f : \operatorname{tail}(f) = \operatorname{head}(e)\} and P(e)={f:head⁡(f)=tail⁡(e)}P(e) = \{f : \operatorname{head}(f) = \operatorname{tail}(e)\} denote its successors and its predecessors. Then for all ii, we compute three encodings given by hidiag(e)=Ki(e,e)h_i^{\mathrm{diag}}(e) = K_i(e,e), hisucc(e)=∑f∈S(e)Ki(e,f)h_i^{\mathrm{succ}}(e) = \sum_{f \in S(e)} K_i(e,f), and hipred(e)=∑f∈P(e)Ki(f,e)h_i^{\mathrm{pred}}(e) = \sum_{f \in P(e)} K_i(f,e). Finally, we define the output of EdgeSPE by EdgeSPE⁡(e)=MLP⁡(hdiag(e),hsucc(e),hpred(e))\operatorname{EdgeSPE}(e) = \operatorname{MLP}(h^{\mathrm{diag}}(e), h^{\mathrm{succ}}(e), h^{\mathrm{pred}}(e)).

Experiments

We evaluate PathLapPE as a positional encoding on a wide array of directed graph settings, including synthetic and real-world benchmarks, regression and classification targets, small and large-scale datasets, node- and graph-level tasks. We additionally analyze the computational cost of PathLapPE. All datasets are directed, and all relevant statistics are provided in Table 4 and Table 5 (Appendix § 14). Additional details on training and model hyperparameters for all tasks are provided in Appendix § 15.

DatasetCornellWisconsinTexasRoman-Empire
# Nodes18325118322,662
# Edges29549932544,363
# Features1,7031,7031,703300
# Classes55518
LicenseCC-BY 4.0CC-BY 4.0CC-BY 4.0MIT

Table 4. Dataset statistics for transductive node-level tasks

DatasetFlowGraph2FlowGraph3FlowGraph6OCBHLS
# Graphs2,0003,0006,0008,026a^{a}18,570
Avg. # Nodes114.46111.66111.409.8994.70
Avg. # Edges150.30150.70149.9315.02122.12
# Node Features00037
# Edge Features00002
TaskBinary class.3-way class.6-way class.RegressionRegression
LicenseCC BY 4.0CC BY 4.0CC BY 4.0CC BY 4.0CC BY 4.0

Table 5. Dataset statistics for inductive graph-level tasks

We compare PathLapPE with (i) no PEs, (ii) LapPE and (iii) RWPE (both Dwivedi et al. [4]), and (iv) Multi-qq-MagLapPE PEs (Huang et al. [12]), using a variety of both conventional and direction-aware GNNs.

In PathLapPE computation, we remove all self-loops, and pad zeros when k>∣V∣k > |V| or ∣E∣|E|. In addition to uni- and bi-directional GAT and GINE models, we evaluate with BiGCN, a model we introduce in Appendix § 13 as an extension of bidirectional GCN that supports edge features that act through a gating mechanism. Moreover, we process all node-level spectral positional encodings using the generalized SPE model introduced in Huang et al. [12], which yields invariant and stable representations. Similarly, we process edge-level PathLapPE encodings with our EdgeSPE, and report results both with and without EdgeSPE.

Synthetic flow graphs

We begin with a simple task based on synthetic flow graphs designed to probe the directional information in PEs, primarily serving as a sanity check. FLOWGRAPH datasets (Wang et al., 2024) are generated by creating clusters of nodes that are then sequentially ordered with a probabilistic directional flow defined between consecutive clusters: n%n\% of the edges flow in one direction (e.g., from cluster cc to c+1c + 1), whereas (100−n)%(100 - n)\% flow in the opposite direction. Classes are defined by n%n\% so that the task is directly tied to learning edge directionality. After computing positional encodings, we convert the graph to undirected (i.e., A(u,v)←max⁡{A(u,v),A(v,u)}A(u,v) \leftarrow\max\{A(u,v), A(v,u)\}) and use a standard (i.e., unidirectional) GINE to force the network to rely only on the PE to solve the task.

Results. We evaluate on FLOWGRAPH K∈{2,3,6}K \in\{2, 3, 6\}, where KK denotes the number of classes defined in each task, and present the results in Figure 3. As expected, No PE and LapPE performance are essentially random, as the GINE layers have no directional information to work with. Multi-qq-Laplacian PEs and PathLapPE can nearly fully solve the task for K=2K = 2, and perform well above random for K∈{3,6}K \in\{3,6\}, indicating that they capture directionality. We observe that a single qq-parameter is more unstable than PathLapPE, which the Multi-qq variants alleviate.

Figure 3. FlowGraph experiments, mean + std for five runs. Only directional PEs (PathLapPE and Multi-qq-MagLapPE) perform above random.

WebKB datasets

We next consider the WebKB datasets CORNELL, WISCONSIN, and TEXAS [19], in which nodes represent web pages and directed edges represent hyperlinks. Node features consist of bag-of-words representations. The task is to classify the nodes as student, project, course, staff, or faculty. We compare PathLapPE with and without EdgeSPE against LapPE, RWPE and Multi-qq-MagLapPE. For the latter, we report the best results over q∈{0.01,0.05,0.10}q \in\{0.01, 0.05, 0.10\}. Additional information on tuning and selected hyperparameters is provided in Appendix § 15.§ 2, Table 7.

FlowGraphWebKBRoman-Empire
Data
Taskgraph cls.node cls.node cls.
Graphs2,000 / 3,000 / 6,00011
Classes2 / 3 / 6518
Input feature dim.1a1^{a}1,703300
Batchingbatch size 32full graphfull graph
Splits500 / 300 / 200 per class10 fixed splits10 fixed splits
Optimization
OptimizerAdamWAdamAdamW
Learning rate8⋅10−38 \cdot10^{-3}5⋅10−35 \cdot10^{-3}3⋅10−53 \cdot10^{-5}
Weight decay05⋅10−45 \cdot10^{-4}0
LR schedulenoneReduceLROnPlateaub^{b}none
Max epochs2003,0001,000
Early stopping (val/acc)–500400
Backbone
Layers (pre / MP / post)1 / 4 / 11 / 2 / 11 / 3 / 1
Stage typeskipsum–skipsum
Jumping knowledge–max–
FFN after convolution––✓
Hidden dim. dd32128512
NormalizationBatchNormL2 NormLayerNorm
Dropout0.0{0.0, 0.5}0.2
ActivationReLUReLUGELU
Graph poolingmean––
Positional encodings
LapPE kk64{16, 32}{8, 16, 32, 64}
MagLapPE kk / qq / #q\#q64 / 0.05 / {1, 3, 5}{16, 32} / {0.01, 0.05, 0.1} / 1{8, 16, 32, 64} / {0.05, 0.1, 0.15} / {1, 3}
PathLapPE kk (node / edge)64{16, 32} / {16, 32}{8, 16, 32, 64}
EncoderSPE (+ EdgeSPE)SPE (+ EdgeSPE)SPE (+ EdgeSPE)

Table 7. Key model and training hyperparameters for the FlowGraph, WebKB and Roman-Empire datasets. All FlowGraph and WebKB datasets share the same configs.

Results. In Table 1, we report mean test accuracy over the ten splits from Pei et al. [19]. PathLapPE improves over the no PE baseline across all architectures and datasets and achieves the best average rank for each model. The gains are largest for BiGINE and BiGCNE, reaching 22.2 and 18.4 percentage points, respectively, compared with at most 7.6 points for GAT. The larger gains for BiGINE and BiGCNE may reflect their ability to incorporate edge features directly into message passing. EdgeSPE further improves performance in most settings, indicating that the direction-aware edge encodings provide complementary information beyond the node-level PathLapPE.

ModelPECORNELLWISCONSINTEXASAvg. Rank ↓
GATNo PE48.37 ± 7.5952.55 ± 4.1159.73 ± 4.125.17
GATRWPE54.05 ± 7.9653.72 ± 6.5560.00 ± 4.383.17
GATLapPE54.05 ± 7.7552.35 ± 8.8259.73 ± 4.844.67
GATMulti-qq-MagLapPE, q∈{0.01,0.05,0.10}q \in\{0.01, 0.05, 0.10\}55.68 ± 7.6753.14 ± 7.0160.27 ± 4.242.67
GATPathLapPE (ours)53.78 ± 6.1756.28 ± 5.3159.46 ± 4.594.00
GATPathLapPE (ours, w/ EdgeSPE)55.95 ± 8.5555.88 ± 7.6961.35 ± 4.041.33
BiGINENo PE54.32 ± 4.8458.43 ± 3.4356.22 ± 9.525.83
BiGINERWPE55.41 ± 8.6658.43 ± 5.3761.35 ± 6.255.17
BiGINELapPE64.60 ± 5.4176.86 ± 9.3364.60 ± 9.573.17
BiGINEMulti-qq-MagLapPE, q∈{0.01,0.05,0.10}q \in\{0.01, 0.05, 0.10\}62.97 ± 10.7479.02 ± 6.3469.19 ± 7.563.00
BiGINEPathLapPE (ours)64.05 ± 7.2178.43 ± 8.5771.62 ± 8.762.33
BiGINEPathLapPE (ours, w/ EdgeSPE)64.60 ± 7.9080.59 ± 5.8869.73 ± 10.571.50
BiGCNENo PE60.27 ± 5.9869.41 ± 6.0865.14 ± 8.405.33
BiGCNERWPE58.92 ± 6.6065.88 ± 6.8068.11 ± 7.075.67
BiGCNELapPE76.75 ± 4.4585.49 ± 5.0881.89 ± 4.043.83
BiGCNEMulti-qq-MagLapPE, q∈{0.01,0.05,0.10}q \in\{0.01, 0.05, 0.10\}77.30 ± 3.1785.49 ± 4.4583.24 ± 7.072.33
BiGCNEPathLapPE (ours)77.03 ± 5.8786.67 ± 5.1383.24 ± 7.072.17
BiGCNEPathLapPE (ours, w/ EdgeSPE)78.65 ± 4.5087.26 ± 3.8482.16 ± 4.801.67

Table 1. Node classification accuracy (mean test accuracy %) on the WEBKB datasets. The best result within each model family is in bold and the second best is underlined.

Large-scale evaluation on Roman-Empire

The WebKB datasets are relatively small and known to be noisy; thus, we next evaluate on a directed variant of ROMAN-EMPIRE (Platonov et al. [20]), a much larger dataset with 22,662 nodes, derived from the Roman Empire Wikipedia page. Each node corresponds to a word; an edge exists between two nodes if one follows the other in the text, or the words are syntactically connected in a sentence. Node features are based on word embeddings. The task is to predict the syntactic role of each word.

In addition to previous models, we evaluate bidirectional GAT and BiGINE-shared, a bidirectional GINE that shares the MLP weights of the GINE convolutions across the two directions. Weight sharing forces the model to rely more on the edge features, i.e., the spectral PEs, rather than on model expressivity to extract directional information, allowing us to evaluate the impact of individual PEs more distinctively. We evaluate two Multi-qq-MagLapPE configurations: the best single qq-value of 0.05, and three stacked qq values. For model architectures and hyperparameter selection, we largely follow Platonov et al. [20]; full experimental details are provided in Appendix § 15.§ 3, Table 7.

Results. Table 2 reports the performance of PathLapPE compared to No PE, LaplacianPE, and Multi-qq-MagLapPE baselines on ROMAN-EMPIRE across five GNN architectures. PathLapPE achieves the best (or approximately equal-best, for BiGAT) result for every architecture. The gap between PathLapPE and the baselines is more pronounced for bidirectional GINE and GCNE, and is particularly large for our BiGINE-shared model, which is structurally restricted to rely on edge features for directionality. We also note that BiGINE-shared benefits more from PEs in general than the other architectures. Interestingly, both conventional GAT and its bidirectional variant benefit the least from (i) PEs in general, and (ii) PathLapPE specifically, with most PEs falling within one standard deviation of the PathLapPE results.

PEBiGINEBiGINE-sharedGATBiGATBiGCNE
Base (No PE)89.48 ± 0.4083.03 ± 0.6383.01 ± 0.3590.36 ± 0.3087.79 ± 0.47
LaplacianPE90.97 ± 0.4287.68 ± 0.4284.19 ± 0.4891.15 ± 0.4089.58 ± 0.57
Multi-qq-MagLapPE, q=0.05q = 0.0590.95 ± 0.3687.66 ± 0.2483.93 ± 0.5691.13 ± 0.4489.63 ± 0.36
Multi-qq-MagLapPE, #q=3q = 3, q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}90.95 ± 0.3387.28 ± 0.3984.32 ± 0.3991.10 ± 0.4589.82 ± 0.35
PathLapPE (ours)<u>91.33 ± 0.23</u>89.50 ± 0.3684.39 ± 0.3991.10 ± 0.4690.29 ± 0.32
PathLapPE (ours, w/ EdgeSPE)91.37 ± 0.32<u>89.17 ± 0.56</u>83.90 ± 0.42<u>91.14 ± 0.27</u><u>90.06 ± 0.45</u>

Table 2. Node classification results (mean test acc. %) on ROMAN-EMPIRE. Best result is bolded, second best is <u>underlined</u>. Best kk (num. eigenpairs) reported, Table 6 lists results for all kk values.

Open Circuit Benchmark & High-Level Synthesis

Finally, we consider inductive, graph-level regression tasks on the Open Circuit Benchmark (OCB) and High-Level Synthesis (HLS) datasets. For each task, we follow the implementations and optimized hyperparameters for BiGINE and GINE from Huang et al. [12].

OCB (Dong et al. [3]) consists of 8,026 operational amplifier-based (op-amp) analog circuits as directed graphs, and the task is to predict DC gain (Gain), bandwidth (BW) and phase margin (PM) for each circuit. We evaluate two Multi-qq-MagLapPE configurations, each with ten qq values but with phase parameters of 0.01 and 0.05.

HLS (Wu et al. (2022)) represents 18,570 C/C++ programs as directed intermediate representation (IR) graphs for performance analysis on FPGA integrated circuits. The task is to predict digital signal processor (DSP) and look-up table (LUT) usage, and critical path timing slack (CP, permitted delay that does not affect overall program runtime) for each program. We evaluate two Multi-qq-MagLapPE configurations, each with five qq values but with phase parameters of 0.01 and 0.1.

Results. Table 3 presents test results for the six tasks across both benchmarks, and the average rank of each PE. PathLapPE with EdgeSPE is the best method on average by some margin with average ranks of 1.50 and 1.83 for BiGINE and GINE respectively, as well as the most consistent: of the twelve model ×\times task combinations evaluated, it is the best method on six, and top-2 on eleven of them – the sole remaining task being GINE ×\times CP, where PEs are not helpful in general. However, PathLapPE without EdgeSPE (where we simply use a linear mapping of the raw edgePEs) is relatively inconsistent, and falls behind not only the EdgeSPE variant but also other PEs on several tasks. The benefits of EdgeSPE are thus more apparent in such inductive settings where learning approximate sign- and basis-invariance is valuable, whereas in transductive node-level tasks one can precompute PEs on a single basis, as all training and inference happens over a single graph. Finally, we noticed that Multi-qq-MagLapPE suffered from instabilities with GINE, where some runs converged to reasonable losses, while others fully diverged over the course of training. We provide a more extensive discussion in Appendix G.4.

PEOCB (RMSE ↓\downarrow)HLS (MSE ↓\downarrow)Avg. Rank ↓\downarrow
GAINBWPMDSPLUTCP
BiGINE
No PE0.394 ±\pm 0.0074.497 ±\pm 0.1111.123 ±\pm 0.0112.254 ±\pm 0.0681.793 ±\pm 0.1741.152 ±\pm 0.0774.08
LapPE0.394 ±\pm 0.0144.223 ±\pm 0.0771.114 ±\pm 0.0222.445 ±\pm 0.2161.767 ±\pm 0.0301.158 ±\pm 0.1323.75
Multi-qq-MagLapPE, #q={5,10}\#q = \{5, 10\}, q=0.01q = 0.010.393 ±\pm 0.0104.156 ±\pm 0.1431.112 ±\pm 0.0152.325 ±\pm 0.1031.783 ±\pm 0.0521.186 ±\pm 0.1073.17
Multi-qq-MagLapPE, #q={5,10}\#q = \{5, 10\}, q∈{0.05,0.1}q \in\{0.05, 0.1\}0.388 ±\pm 0.0154.215 ±\pm 0.1281.121 ±\pm 0.0182.335 ±\pm 0.1371.856 ±\pm 0.1341.383 ±\pm 0.3484.17
PathLapPE (ours)0.384 ±\pm 0.0144.236 ±\pm 0.1021.147 ±\pm 0.0052.625 ±\pm 0.1212.096 ±\pm 0.0831.113 ±\pm 0.0934.33
PathLapPE (ours, w/ EdgeSPE)0.367 ±\pm 0.0054.036 ±\pm 0.0921.102 ±\pm 0.0262.322 ±\pm 0.0831.771 ±\pm 0.1311.118 ±\pm 0.0691.50
GINE
No PE0.415 ±\pm 0.0074.817 ±\pm 0.1101.126 ±\pm 0.0192.662 ±\pm 0.2152.009 ±\pm 0.0920.654 ±\pm 0.0342.92
LapPE0.411 ±\pm 0.0204.349 ±\pm 0.0761.127 ±\pm 0.0302.738 ±\pm 0.2792.031 ±\pm 0.1390.680 ±\pm 0.0253.33
Multi-qq-MagLapPE, #q={5,10}\#q = \{5, 10\}, q=0.01q = 0.010.410 ±\pm 0.0174.328 ±\pm 0.1591.117 ±\pm 0.0152.885 ±\pm 0.25121.35 ±\pm 37.641.639 ±\pm 2.1523.50
Multi-qq-MagLapPE, #q={5,10}\#q = \{5, 10\}, q∈{0.05,0.1}q \in\{0.05, 0.1\}1.109 ±\pm 0.22644.98 ±\pm 39.941.120 ±\pm 0.0162.910 ±\pm 0.03413.67 ±\pm 18.622.795 ±\pm 2.2815.17
PathLapPE (ours)0.415 ±\pm 0.0214.252 ±\pm 0.1461.149 ±\pm 0.0243.043 ±\pm 0.2092.353 ±\pm 0.0950.691 ±\pm 0.0474.25
PathLapPE (ours, w/ EdgeSPE)0.379 ±\pm 0.0094.226 ±\pm 0.1281.119 ±\pm 0.0192.717 ±\pm 0.1371.946 ±\pm 0.0610.697 ±\pm 0.0461.83

Table 3. Test set results for Open Circuit Benchmark and High-Level Synthesis. Mean ±\pm std reported across five seeds. Best result is bolded, second best is underlined. Multi-qq-MagLapPE uses #q=10\#q = 10 for OCB, and #q=5\#q = 5 for HLS.

Computational cost of PathLapPE

PathLapPE has different scaling properties than other spectral encodings: the L0L_0 and L1L_1 path Laplacians scale with ∣V∣|V| (like LapPE) and ∣E∣|E|, respectively, so PathLapPE computation is more efficient on sparser graphs. In Figure 4, we grow Erdős–Rényi graphs at two fixed densities (average out-degree two and four) and measure PE computation time and GPU memory. On the sparser graphs, PathLapPE is faster than Multi-qq-MagLapPE for #q≥3\#q \ge3 at scale. On the denser graphs, its cost is just above that of #q=10\#q = 10. PathLapPE uses more memory than Multi-qq-MagLapPE, which processes qq values sequentially at fixed memory cost. For large graphs, sparse eigensolvers ((Virtanen et al., 2020)) can reduce this memory at a modest cost in time. Appendix § 16, Table 10 reports time and memory on our benchmarks; on the largest, R​​oman-E​​mpire (22,662 nodes), sparse PathLapPE takes three seconds and 70 MB, making PE computation costs negligible compared to training. Overall, the additional computational cost of PathLapPE relative to Multi-qq-LapPE is modest, especially considering the additional benefit that PathLapPE requires no tuning.

Figure 4. Time (left pair) and memory (right pair) cost of PE computation on directed ER graphs on an NVIDIA L40S GPU. Dense solver on GPU, k=8k = 8, three repeats for each experiment.

PEROMAN-EMPIREROMAN-EMPIREFLOWGRAPHFLOWGRAPHOCBOCB
shift-invert, heap mem.CPU dense, heap mem.GPU dense, GPU mem.
Time (s)Mem (MB)Time (ms)Mem (MB)Time (ms)Mem (MB)
LapPE0.154 ± 0.0074.493.00 ± 0.230.242.20 ± 0.130.56
Multi-qq-MagLapPE, #qq = 10.257 ± 0.0018.502.96 ± 0.170.252.21 ± 0.101.12
Multi-qq-MagLapPE, #qq = 30.704 ± 0.00111.36.59 ± 0.440.274.23 ± 0.241.12
Multi-qq-MagLapPE, #qq = 51.074 ± 0.01614.110.15 ± 0.670.306.23 ± 0.381.12
Multi-qq-MagLapPE, #qq = 102.102 ± 0.02221.019.43 ± 1.810.3311.06 ± 1.091.12
PathLapPE (ours)3.053 ± 0.01570.522.46 ± 1.150.6214.31 ± 0.830.60

Table 10. Positional encoding precompute cost per graph. Each dataset is denoted with the optimal eigensolver strategy used for decomposition and the type of memory measured.

Conclusion

We introduced PathLapPE, a spectral positional encoding for directed graphs derived from the Laplacian of the path complex. PathLapPE provides real-valued node- and edge-level encodings that capture edge orientation and directed 2-path structure, without the computational burden of higher-order message-passing. We additionally provide EdgeSPE, which further improves the performance of edge-level encodings. Across a wide range of node- and graph-level directed benchmarks, PathLapPE performs as well as or better than other spectral PEs, with the largest gains for direction-aware architectures. Unlike magnetic Laplacian encodings, it has no phase parameter to tune and requires only one real eigendecomposition per Laplacian, making it computationally efficient. Extending our PE to path Laplacians of higher order and reducing memory cost on denser graphs, as well as the inclusion into graph Transformers, are natural directions for future work.

Acknowledgements and Disclosure of Funding

This work was partially funded by Bourse en intelligence artificielle des Études supérieures et postdoctorales (ESP) 2023–2024, Bourse d’excellence du DIRO (2025) [S.C.], and Bourse de fin d’études doctorales (2026–2027) [S.C. and L.M.]; NSF OIA 2242769 [M.P.]; Canada CIFAR AI Chair, IVADO (Institut de valorisation des données) grant PRF-2019-3583139727, FRQNT (Fonds de recherche du Québec – Nature et technologies) grant 299376, and NSERC Discovery Grant 03267 [G.W.]; and NSF DMS grant 2327211 [M.P. and G.W.]. This work has received funding from the Swiss State Secretariat for Education, Research and Innovation (SERI) [B.R.]. This research was also enabled in part by computing resources provided by Mila (mila.quebec). The content provided here is solely the responsibility of the authors and does not necessarily represent the official views of the funding agencies.

AI Use Statement

Generative AI usage in this work has been strictly limited to light text editing, adjustments of provided figures (e.g., TikZ adjustments for Figure 2), and writing minor boilerplate code. Generative AI tools have not been used for the development of the mathematical framework nor the accompanying formulation or proving of mathematical claims, experiment design, dataset generation, data analysis nor core development of the codebase. We have, of course, reviewed all AI-assisted work. LLM adjustments to any text and figures have been checked by multiple authors; any LLM-generated code adjustments have also been verified and tested for correctness. We take responsibility for the final content of this work, including text, claims or artifacts produced with the aid of generative AI.

Overview of PathLapPE construction and feature extraction pipeline

Figure 2. Overview of PathLapPE construction and feature extraction pipeline.

Limitations

In this work, we have considered path Laplacians only up to order p=2p = 2; higher-order constructions are possible, albeit at increasing computational costs. In conjunction with this point, PathLapPE construction and eigendecomposition is inherently more memory-intensive on dense graphs due to its scaling with respect to the number of edges. While efficient workarounds exist particularly for eigendecomposition, extending to even higher-order paths would exacerbate these memory limitations. Our evaluation also largely focuses on uni- and bidirectional GNNs; while we expect the observed performance gains to naturally extend to graph Transformers, further evaluations on Transformer-based architectures would solidify this claim. Finally, in our research we have observed that there is limited work on whether directionality is truly beneficial to a given task on directed benchmarks; future work on investigating types of directed graphs that would benefit from PathLapPE would increase the potential impact of our method.

The magnetic Laplacian

For undirected graphs, the standard graph Laplacian provides a canonical self-adjoint operator whose eigenvectors encode global graph structure. In the directed setting, however, there is no unique analogue of the graph Laplacian. Different constructions preserve different aspects of directionality. In this section, we briefly describe magnetic Laplacians, which encode directionality through complex phases.

Let G=(V,E⃗)G = (V, \vec{E}) be a directed graph with adjacency matrix AA, where Auv=1A_{uv} = 1 if (u,v)∈E⃗(u,v) \in\vec{E} and Auv=0A_{uv} = 0 otherwise. Magnetic Laplacian constructions first define a symmetrized adjacency matrix As=12(A+AT)A_s = \frac{1}{2}(A + A^{\mathsf{T}}), which records the undirected support of the graph, possibly with weights reflecting whether one or both orientations are present. Directionality is then incorporated through a skew-symmetric phase matrix Θ(q)=2πq(A−AT)\Theta^{(q)} = 2\pi q(A - A^{\mathsf{T}}), where qq is a tunable phase parameter controlling the strength of the directional signal. The corresponding complex Hermitian adjacency matrix is given by

H(q)=As⊙exp⁡(iΘ(q)),H^{(q)} = A_s \odot\exp\left(\mathrm{i}\Theta^{(q)}\right),

where ⊙\odot denotes entrywise multiplication. The degree matrix associated with AsA_s is given by Ds(u,u)=∑v∈VAs(u,v)D_s(u,u) = \sum_{v \in V} A_s(u,v). The unnormalized magnetic Laplacian is then defined by

Lmag(q)=Ds−H(q).L_{\mathrm{mag}}^{(q)} = D_s - H^{(q)}.

The normalized version

Lmag(q)=I−Ds−1/2H(q)Ds−1/2\mathcal{L}_{\mathrm{mag}}^{(q)} = I - D_s^{-1/2}H^{(q)}D_s^{-1/2}

is often used in graph learning.

Proof of Theorem 1

In this section, we provide a proof of Theorem 1. We recall that any directed graph G=(V,E⃗)G = (V, \vec{E}) gives rise to a vector space Λp\Lambda_p spanned by elementary pp-paths, a vector space Ap⊆Λp\mathcal{A}_p \subseteq\Lambda_p spanned by allowed elementary pp-paths and finally the main object of interest in this section, the vector space Ωp⊆Ap\Omega_p \subseteq\mathcal{A}_p of ∂\partial-invariant allowed paths. In this section, p=1,2p = 1, 2, and we are interested in constructing a basis for Ω2\Omega_2 in closed form. Before proving Theorem 1, we first consider the following example, in which we compute a basis for Ω2\Omega_2 in a simple case.

Example 3. As in Example 1, consider the directed triangle represented in Figure 1(a) and the elementary paths u=abu = ab, v=bcv = bc, w=acw = ac, and t=abct = abc. Then, an ordered basis for Ω2\Omega_2 is given by the vertices aa, bb, and cc and an ordered basis for Ω1\Omega_1 is given by the 1-paths corresponding to the directed edges uu, vv, and ww. Since ∂t=bc−ac+ab=v−w+u\partial t = bc - ac + ab = v - w + u, we conclude that tt is a ∂\partial-invariant allowed path, hence an element of Ω2\Omega_2. One may also verify that there are no other independent elements of Ω2\Omega_2 and so Ω2\Omega_2 is a one-dimensional vector space with basis {t}\{t\}. Given these choices of bases (in the order listed above), the boundary matrices are given by

B1=[−10−11−10011];B2=[11−1]T.B_1 = \begin{bmatrix} -1 & 0 & -1 \\ 1 & -1 & 0 \\ 0 & 1 & 1 \end{bmatrix} ;\quad B_2 = \begin{bmatrix} 1 & 1 & -1 \end{bmatrix}^{\mathsf{T}}.

The unweighted edge Laplacian is therefore L1=B2B2T+B1TB1=3I3\mathbf{L}_1 = \mathbf{B}_2\mathbf{B}_2^{\mathsf{T}} + \mathbf{B}_1^{\mathsf{T}}\mathbf{B}_1 = 3\mathbf{I}_3.

We recall from § 3.2 that Λ1\Lambda_1 can be expressed as the direct sum A1⊕D1\mathcal{A}_1 \oplus\mathcal{D}_1 and the corresponding projection maps πA(1):Λ1→A1\pi_{\mathcal{A}}^{(1)} : \Lambda_1 \to\mathcal{A}_1, and πD(1):Λ1→D1\pi_{\mathcal{D}}^{(1)} : \Lambda_1 \to\mathcal{D}_1 induce the maps

∂2A:A2→A1;∂2A(σ)↦πA(1)∘∂2(σ),\partial_2^{\mathcal{A}} : \mathcal{A}_2 \to\mathcal{A}_1;\quad\partial_2^{\mathcal{A}}(\sigma) \mapsto\pi_{\mathcal{A}}^{(1)} \circ\partial_2(\sigma),

and

∂2D:A2→D1;∂2D(σ)↦πD(1)∘∂2(σ).(7)\partial_2^{\mathcal{D}} : \mathcal{A}_2 \to\mathcal{D}_1;\quad\partial_2^{\mathcal{D}}(\sigma) \mapsto\pi_{\mathcal{D}}^{(1)} \circ\partial_2(\sigma). \tag*{(7)}

Here ∂2:Λ2→Λ1\partial_2 : \Lambda_2 \to\Lambda_1 is the usual boundary map on pp-paths. Note that, by definition, Ω2\Omega_2 is equal to ker⁡∂2D\ker\partial_2^{\mathcal{D}} since σ\sigma is in Ω2\Omega_2 if and only if ∂2(σ)∈A1\partial_2(\sigma) \in\mathcal{A}_1 and D1\mathcal{D}_1 is the orthogonal complement of A1\mathcal{A}_1.

We consider the basis of Λp\Lambda_p consisting of elementary pp-paths, and fix an ordering for the basis, denoted by:

BΛ(p):={σi(p)∣i=1,…,dim⁡(Λp)}.\mathcal{B}_{\Lambda}^{(p)} := \{\sigma_i^{(p)} \mid i = 1,\ldots,\dim(\Lambda_p)\}.

The basis of Ap\mathcal{A}_p is the subset BA(p)⊆BΛ(p)\mathcal{B}_{\mathcal{A}}^{(p)} \subseteq\mathcal{B}_{\Lambda}^{(p)} corresponding to the allowed paths. We similarly denote by BD(1)⊆BΛ(1)\mathcal{B}_{\mathcal{D}}^{(1)} \subseteq\mathcal{B}_{\Lambda}^{(1)} the basis of D1\mathcal{D}_1 formed by the non-allowed elementary 1-paths. Finally, we denote by B2D\mathbf{B}_2^{\mathcal{D}} the matrix representation of the map ∂2D\partial_2^{\mathcal{D}} defined in Equation (7), expressed with respect to the bases BA(2)\mathcal{B}_{\mathcal{A}}^{(2)} and BD(1)\mathcal{B}_{\mathcal{D}}^{(1)}.

Proof. Consider an arbitrary elementary allowed 2-path σj(2)=v0v1v2\sigma_j^{(2)} = v_0v_1v_2. By definition,

∂2(σj(2))=v1v2−v0v2+v0v1.(8)\partial_2(\sigma_j^{(2)}) = v_1v_2 - v_0v_2 + v_0v_1. \tag*{(8)}

Since σj(2)\sigma_j^{(2)} is an allowed path, the edges v0v1v_0v_1 and v1v2v_1v_2 are allowed 1-paths (i.e., directed edges in GG). If v0=v2v_0 = v_2, the elementary 2-path σj(2)\sigma_j^{(2)} is ∂\partial-invariant. Indeed, by definition of Λ1\Lambda_1 paths of the form viviv_iv_i are identified with zero. Assume v0≠v2v_0 \ne v_2 then,

∂2D(σj(2))=−πD(1)(v0v2).\partial_2^{\mathcal{D}}(\sigma_j^{(2)}) = -\pi_{\mathcal{D}}^{(1)}(v_0v_2).

Hence, σj(2)∈Ω2\sigma_j^{(2)} \in\Omega_2 if and only if v0v2∈A1v_0v_2 \in\mathcal{A}_1. Thus, if v0v2v_0v_2 is an allowed 1-path, then B2D[:,j]=0\mathbf{B}_2^{\mathcal{D}}[:,j] = 0 and so σj(2)\sigma_j^{(2)} is ∂\partial-invariant and an element of Ω2\Omega_2. Otherwise, let σi(1)=v0v2∈BD(1)\sigma_i^{(1)} = v_0v_2 \in\mathcal{B}_{\mathcal{D}}^{(1)}. Then, B2D[i,j]=−1\mathbf{B}_2^{\mathcal{D}}[i,j] = -1. Assume there exist exactly mm elementary allowed 2-paths σj1(2),…,σjm(2)\sigma_{j_1}^{(2)}, \ldots, \sigma_{j_m}^{(2)} satisfying

∂2D(σjq(2))=−σi(1),q=1,…,m.\partial_2^{\mathcal{D}}(\sigma_{j_q}^{(2)}) = -\sigma_i^{(1)}, \qquad q = 1,\ldots,m.

Then, the restriction of B2D[i,:]\mathbf{B}_2^{\mathcal{D}}[i,:] to these basis vectors corresponds to the constant row vector of length mm given by

−1T=(−1,…,−1).-\mathbf{1}^{\mathsf{T}} = (-1,\ldots,-1).

Since Ω2≃ker⁡B2D\Omega_2 \simeq\ker\mathbf{B}_2^{\mathcal{D}}, it remains to construct a basis for the kernel of −1T-\mathbf{1}^{\mathsf{T}}. If m=1m=1, this kernel is trivial. For m>1m>1, consider the column vectors in Rm\mathbb{R}^m given by

1ℓ(ℓ+1)(1,…,1,−ℓ,0,…,0)T,1≤ℓ<m.(9)\frac{1}{\sqrt{\ell(\ell+1)}}\left(1,\ldots,1,-\ell,0,\ldots,0\right)^{\mathsf{T}}, \qquad1 \le\ell< m. \tag*{(9)}

It is straightforward to verify that these vectors constitute an orthonormal basis for ker⁡(−1T)\ker(-\mathbf{1}^{\mathsf{T}}). Writing them with respect to the basis elements σj1(2),…,σjm(2)\sigma_{j_1}^{(2)},\ldots,\sigma_{j_m}^{(2)} gives the 2-paths

hℓ=1ℓ(ℓ+1)(∑q=1ℓσjq(2)−ℓσjℓ+1(2)),ℓ=1,…,m−1.h_\ell= \frac{1}{\sqrt{\ell(\ell+1)}}\left(\sum_{q=1}^{\ell}\sigma_{j_q}^{(2)}-\ell\sigma_{j_{\ell+1}}^{(2)}\right), \qquad\ell=1,\ldots,m-1.

Finally, every column of B2D\mathbf{B}_2^{\mathcal{D}} is either zero or contains exactly one nonzero entry. The nonzero columns can therefore be partitioned according to the non-allowed elementary 1-path appearing in their boundary. Combining the ∂\partial-invariant elementary 2-paths corresponding to the zero columns with the vectors hℓh_\ell constructed for each such group gives a basis for ker⁡B2D\ker\mathbf{B}_2^{\mathcal{D}}, and therefore for Ω2\Omega_2.

Remark 1. The basis in Theorem 1 is consistent with the structural description of Ω2\Omega_2 given by Grigor’yan et al. [9] (see also Grigor’yan [8]), where Ω2\Omega_2 is shown to be spanned by triangles, squares, and double arrows (i.e., 2-paths in Figure 1(a), (b), and (c), respectively). In our construction, double arrows and triangles are precisely ∂\partial-invariant elementary 2-paths. For a fixed non-allowed elementary 1-path τ\tau, the remaining basis vectors satisfy

hℓ=1ℓ(ℓ+1)∑q=1ℓ(σq−σℓ+1),h_\ell= \frac{1}{\sqrt{\ell(\ell+1)}}\sum_{q=1}^{\ell}(\sigma_q-\sigma_{\ell+1}),

and therefore lie in the span of the corresponding squares (i.e., 2-paths illustrated in Figure 1 (b)). Thus, Theorem 1 can be viewed as an orthonormal refinement of this spanning description.

The orthonormality is also useful for constructing the path Laplacian. Indeed, the matrix formula

Lp=Bp+1Bp+1T+BpTBpL_p = B_{p+1}B_{p+1}^{\mathsf{T}} + B_p^{\mathsf{T}}B_p

assumes that the boundary matrices are represented with respect to orthonormal bases.

Let M2M_2 denote the Gram matrix of a chosen basis of Ω2\Omega_2 with respect to the induced inner product. Since the natural bases of Ω0\Omega_0 and Ω1\Omega_1 (the vertex set and directed edge set, respectively) are orthonormal, the matrix representation of the adjoint ∂2∗\partial_2^* is

[∂2∗]=M2−1B2T.[\partial_2^*] = M_2^{-1}B_2^{\mathsf{T}}.

Hence, for an arbitrary basis of Ω2\Omega_2,

L1=B2M2−1B2T+B1TB1.L_1 = B_2M_2^{-1}B_2^{\mathsf{T}} + B_1^{\mathsf{T}}B_1.

For the orthonormal basis of Ω2\Omega_2 given in Theorem 1, M2=IM_2=I, recovering the simpler expression

L1=B2B2T+B1TB1.L_1 = B_2B_2^{\mathsf{T}} + B_1^{\mathsf{T}}B_1.

Our closed-form basis therefore avoids an additional numerical orthogonalization or Gram-matrix correction when constructing L1L_1.

  1. Input: Directed graph G=(V,E⃗)G=(V,\vec{E})

  2. Construct the set A2\mathcal{A}_2 of allowed 2-paths and B2DB_2^{\mathsf{D}}, the matrix representation of ∂2D\partial_2^{\mathsf{D}}.

  3. Initialize BΩ2←∅\mathcal{B}_{\Omega_2}\leftarrow\varnothing and R←∅\mathcal{R}\leftarrow\varnothing.

  4. for i=1,…,∣A2∣i=1,\ldots,|\mathcal{A}_2| do

  5. if B2D[:,i]=0B_2^{\mathsf{D}}[:,i]=0 then

  6. Add eie_i to BΩ2\mathcal{B}_{\Omega_2}.

  7. else

  8. Let rr be the unique row such that (B2D)ri≠0(B_2^{\mathsf{D}})_{ri}\ne0.

  9. if r∉Rr\notin\mathcal{R} then

  10. Let Jr={j1,…,js}:={j:(B2D)rj≠0}J_r=\{j_1,\ldots,j_s\}:=\{j:(B_2^{\mathsf{D}})_{rj}\ne0\}.

  11. for ℓ=1,…,s−1\ell=1,\ldots,s-1 do

  12. Add to BΩ2\mathcal{B}_{\Omega_2}

hℓ=1ℓ(ℓ+1)(∑q=1ℓejq−ℓejℓ+1)h_\ell=\frac{1}{\sqrt{\ell(\ell+1)}}\left(\sum_{q=1}^{\ell}e_{j_q}-\ell e_{j_{\ell+1}}\right)
  1. end for

  2. R←R∪{r}\mathcal{R}\leftarrow\mathcal{R}\cup\{r\}.

  3. end if

  4. end if

  5. end for

  6. return BΩ2\mathcal{B}_{\Omega_2}.

Further Discussion on SPE

As shown in Huang et al. [11], SPE is invariant to the choice of eigenbasis and in particular is invariant to sign flips. We briefly review why that is the case.

Let μ1<⋯<μr\mu_1 < \cdots< \mu_r denote the distinct eigenvalues among λ1,…,λd\lambda_1,\ldots,\lambda_d. For each 1≤j≤r1 \le j \le r, we let Ij={i:λi=μj}I_j = \{i : \lambda_i = \mu_j\} and let Vj∈Rn×∣Ij∣V_j \in\mathbb{R}^{n \times|I_j|} denote the submatrix of VV whose columns are the corresponding eigenvectors (i.e., the ViV_i, i∈Iji \in I_j). Writing the kernel QℓQ_\ell as a sum of rank-one terms yields

Qℓ=Vdiag⁡(ϕℓ(λ))VT=∑i=1dϕℓ(λ)iViViT.Q_\ell= V \operatorname{diag}(\phi_\ell(\lambda)) V^\mathsf{T} = \sum_{i=1}^{d} \phi_\ell(\lambda)_i V_i V_i^\mathsf{T}.

Let ii and i′i' be two indices with λi=λi′\lambda_i = \lambda_{i'}, and let π\pi be the transposition π\pi of ii and i′i'. By construction, πλ=λ\pi\lambda= \lambda, so permutation equivariance gives

ϕℓ(λ)=ϕℓ(πλ)=πϕℓ(λ),\phi_\ell(\lambda) = \phi_\ell(\pi\lambda) = \pi\phi_\ell(\lambda),

i.e., ϕℓ(λ)i=ϕℓ(λ)i′\phi_\ell(\lambda)_i = \phi_\ell(\lambda)_{i'}. Therefore, letting wℓjw_{\ell j} denote the unique value of ϕℓ(λ)i\phi_\ell(\lambda)_i for i∈Iji \in I_j, we may write

Qℓ=∑j=1rwℓjVjVjT.(10)Q_\ell= \sum_{j=1}^{r} w_{\ell j} V_j V_j^\mathsf{T}. \tag*{(10)}

Each of the terms VjVjTV_j V_j^\mathsf{T} is simply a projection matrix onto the eigenspace of μj\mu_j. Projection does not depend on the choice of eigenbasis and so QℓQ_\ell is invariant to the choice of basis (in particular it is invariant to sign flips). Therefore SPE is invariant as well.

Huang et al. [11] also show, in Theorem 3.1, that if ϕℓ\phi_\ell and ρ\rho are Lipschitz, then SPE is stable with respect to the input Laplacian LL (with a Lipschitz constant that depends on the eigengap γ=λd+1−λd\gamma= \lambda_{d+1} - \lambda_d). Furthermore, in Proposition 3.2, it is shown that SPE can universally approximate any continuous basis invariant function. Finally, they also show that SPE makes effective use of the eigenvalues (in addition to the eigenvectors) and can count cycles in Propositions 3.3 and 3.4.

BiGCNE: Directed Gated GCN with Node and Edge Positional Encodings

PathLapPE provides positional information at both the node and edge levels. To leverage our direction-aware edge PE while maintaining a fair comparison with other node-level PEs, we use an edge-gated extension of bidirectional message passing, which we denote by BiGCNE. Following the Dir-GNN framework (Rossi et al., 2024), incoming information and outgoing information are aggregated separately. In addition, the contribution of each neighboring node is modulated by a learned gate that depends on the positional encoding of the corresponding directed edge.

Let xix_i denote the input features of node ii, let pinodep_i^{\mathrm{node}} denote its node-level positional encoding, and let pijedgep_{ij}^{\mathrm{edge}} denote the edge-level positional encoding associated with the directed edge (i,j)∈E⃗(i,j) \in\vec{E}. The node-level positional encoding is incorporated into the initial node representation via concatenation, that is, x~i=[xi∥pinode]\tilde{x}_i = [x_i \mathbin\Vert p_i^{\mathrm{node}}]. Moreover, we let hi(0)h_i^{(0)} denote the resulting initial hidden representation after the input embedding. At each BiGCNE layer ℓ\ell, messages from incoming and outgoing neighbors are computed separately. For an incoming edge (j,i)∈E⃗(j,i) \in\vec{E}, the corresponding gate is given by

γijin,(ℓ)=σ((wg,in(ℓ))Tpijedge+bg,in(ℓ)).\gamma_{ij}^{\mathrm{in},(\ell)} = \sigma\left((w_{g,\mathrm{in}}^{(\ell)})^\mathsf{T} p_{ij}^{\mathrm{edge}} + b_{g,\mathrm{in}}^{(\ell)}\right).

where wg,in(ℓ)w_{g,\mathrm{in}}^{(\ell)} and bg,in(ℓ)b_{g,\mathrm{in}}^{(\ell)} are learnable weights and biases, respectively. The incoming messages are then obtained by

miin,(ℓ)=AGG⁡(j,i)∈E⃗(γijin,(ℓ)Win(ℓ)hj(ℓ)).m_i^{\mathrm{in},(\ell)} = \operatorname{AGG}_{(j,i)\in\vec{E}}\left(\gamma_{ij}^{\mathrm{in},(\ell)} W_{\mathrm{in}}^{(\ell)} h_j^{(\ell)}\right).

Similarly, for an outgoing edge (i,j)∈E⃗(i,j) \in\vec{E}, we define the gate

γijout,(ℓ)=σ((wg,out(ℓ))Tpijedge+bg,out(ℓ)).\gamma_{ij}^{\mathrm{out},(\ell)} = \sigma\left((w_{g,\mathrm{out}}^{(\ell)})^\mathsf{T} p_{ij}^{\mathrm{edge}} + b_{g,\mathrm{out}}^{(\ell)}\right).

and the outgoing messages by

miout,(ℓ)=AGG⁡(i,j)∈E⃗(γijout,(ℓ)Wout(ℓ)hj(ℓ)).\mathbf{m}_i^{\mathrm{out},(\ell)} = \operatorname{AGG}_{(i,j)\in\vec{E}}\left(\gamma_{ij}^{\mathrm{out},(\ell)}\mathbf{W}_{\mathrm{out}}^{(\ell)}\mathbf{h}_j^{(\ell)}\right).

Here, σ\sigma denotes the sigmoid function. We use scalar edge gates, so that each γijin,(ℓ)\gamma_{ij}^{\mathrm{in},(\ell)} or γijout,(ℓ)\gamma_{ij}^{\mathrm{out},(\ell)} controls the overall contribution of the corresponding message. The incoming and outgoing branches have independent learnable parameters. In our implementation, AGG⁡\operatorname{AGG} is mean aggregation. The current node representation and the two directional aggregates are then concatenated and combined through a learnable transformation:

hi(ℓ+1)=Dropout⁡(ReLU⁡(Wcom(ℓ)[hi(ℓ)∥miin,(ℓ)∥miout,(ℓ)]+bcom(ℓ))).\mathbf{h}_i^{(\ell+1)} = \operatorname{Dropout}\left(\operatorname{ReLU}\left(\mathbf{W}_{\mathrm{com}}^{(\ell)}\left[\mathbf{h}_i^{(\ell)} \mathbin\Vert\mathbf{m}_i^{\mathrm{in},(\ell)} \mathbin\Vert\mathbf{m}_i^{\mathrm{out},(\ell)}\right] + \mathbf{b}_{\mathrm{com}}^{(\ell)}\right)\right).

When the input and output dimensions agree, a residual connection is added (i.e. hi(ℓ+1)=hi(ℓ+1)+hi(ℓ)\mathbf{h}_i^{(\ell+1)} = \mathbf{h}_i^{(\ell+1)} + \mathbf{h}_i^{(\ell)}). Unlike the classical Dir-GNN, which combines incoming and outgoing messages using a predefined parameter α\alpha, we use the edge-level positional encoding to modulate message passing through the learned gates at each layer. This direction-aware architecture preserves structural and directionality information captured through the PE that would otherwise be diluted by traditional architectures such as GCN. A directed gated encoder modulates information flow rather than simply appending the aggregated edge PEs to the node features.

Dataset statistics

In Table 4 and Table 5, we report basic statistics for the benchmark datasets considered in this paper for node-level and graph-level tasks, respectively.

Experimental details & Hyperparameters

Synthetic flow graphs

FlowGraph datasets (Wang et al., 2024) are generated by creating clusters of nodes with random interconnections that are then sequentially ordered with a probabilistic directional flow defined between consecutive clusters: n%n\% of the edges flow in one direction (e.g., from cluster cc to c+1c + 1), whereas (100−n)%(100-n)\% flow in the opposite direction. Classes are defined by n%n\% so that the task is directly tied to learning edge directionality, with each class assigned 1,000 samples. After computing positional encodings, we convert the graph to undirected and use a vanilla (i.e., unidirectional) GINE to force the network to rely only on the PE to solve the task. Hyperparameters for FLOWGRAPH are provided in Table 7.

WebKB datasets

On all WebKB datasets, the number of message passing layers is set to two, and a grid search is performed over the following parameter values: dropout ∈{0.0,0.5}\in\{0.0, 0.5\}, number of eigenvalues knode,kedge∈{16,32}k_{\mathrm{node}}, k_{\mathrm{edge}} \in\{16, 32\}, and q∈{0.01,0.05,0.10}q \in\{0.01, 0.05, 0.10\} for Multi-qq-MagLapPE. Note that we do not stack the magnetic Laplacian encodings for several values of qq here; the tested values of qq and α\alpha were selected based on the best results reported in Zhang et al. (2021) and Rossi et al. (2024). Hyperparameters for all WEBKB datasets are provided in Table 7.

Roman-Empire

Roman-Empire is derived from the Wikipedia entry of the same name, where each node in the graph corresponds to a word in the text, not necessarily unique. An edge exists between two nodes if (i) one follows the other in the text, or (ii) the words are syntactically connected in a sentence. Node features are based on word embeddings, and the task is to predict the syntactic role of each word. Despite the semantic relationships in the graph implying directed edges, Platonov et al. [20] provide an undirected graph. Rossi et al. (2024) then provide a directed version using the same general construction but processing the graph to account for directionality; we evaluate our method on this directed version.

We evaluate two Multi-qq-MagLapPE configurations: the best single qq-value of 0.05, after searching over q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}, as well as a version that uses all three qq values, following Huang et al. [12] – stacking PEs derived from multiple qq values typically outperforms any single qq-value. For all PEs, we search over k∈{8,16,32,64}k \in\{8, 16, 32, 64\}, i.e., the number of nontrivial eigenvectors/eigenvalues, and report the best results. Table 6 provides the full results for all kk values.

EncoderPE Variantk=8k=8k=16k=16k=32k=32k=64k=64Best
BiGINE-sharedBase (No PE)83.03 ± 0.6383.03 ± 0.6383.03 ± 0.6383.03 ± 0.6383.03 ± 0.63
BiGINE-sharedLaplacianPE87.68 ± 0.4287.44 ± 0.2387.60 ± 0.3187.53 ± 0.4287.68 ± 0.42
BiGINE-sharedMulti-qq-MagLapPE, q=0.05q = 0.0587.66 ± 0.2487.47 ± 0.3687.52 ± 0.4287.64 ± 0.4087.66 ± 0.24
BiGINE-sharedMulti-qq-MagLapPE, q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}87.10 ± 0.6887.28 ± 0.3987.17 ± 0.5287.16 ± 0.5387.28 ± 0.39
BiGINE-sharedPathLapPE (256 × 2)89.31 ± 0.4489.43 ± 0.4289.36 ± 0.4189.25 ± 0.3789.43 ± 0.42
BiGINE-sharedPathLapPE89.50 ± 0.3689.15 ± 0.2989.12 ± 0.4189.25 ± 0.4189.50 ± 0.36
BiGINE-sharedPathLapPE (EdgeSPE)89.11 ± 0.4889.17 ± 0.5689.01 ± 0.5789.05 ± 0.4589.17 ± 0.56
BiGINEBase (No PE)89.48 ± 0.4089.48 ± 0.4089.48 ± 0.4089.48 ± 0.4089.48 ± 0.40
BiGINELaplacianPE90.93 ± 0.4490.97 ± 0.4290.84 ± 0.3890.89 ± 0.3190.97 ± 0.42
BiGINEMulti-qq-MagLapPE, q=0.05q = 0.0590.93 ± 0.3490.90 ± 0.3090.95 ± 0.3690.86 ± 0.3290.95 ± 0.36
BiGINEMulti-qq-MagLapPE, q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}90.86 ± 0.2390.95 ± 0.3390.94 ± 0.3790.91 ± 0.3090.95 ± 0.33
BiGINEPathLapPE (256 × 2)91.28 ± 0.3091.30 ± 0.3191.38 ± 0.2991.31 ± 0.3491.38 ± 0.29
BiGINEPathLapPE91.28 ± 0.3091.03 ± 0.2891.19 ± 0.3291.33 ± 0.2391.33 ± 0.23
BiGINEPathLapPE (EdgeSPE)91.28 ± 0.3891.37 ± 0.3291.30 ± 0.2991.37 ± 0.2691.37 ± 0.32
GATBase (No PE)83.01 ± 0.3583.01 ± 0.3583.01 ± 0.3583.01 ± 0.3583.01 ± 0.35
GATLaplacianPE83.94 ± 0.8283.69 ± 0.6884.19 ± 0.4884.06 ± 0.4784.19 ± 0.48
GATMulti-qq-MagLapPE, q=0.05q = 0.0583.76 ± 0.4183.79 ± 0.5483.75 ± 0.4583.93 ± 0.5683.93 ± 0.56
GATMulti-qq-MagLapPE, q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}84.32 ± 0.3984.26 ± 0.6584.03 ± 0.4283.79 ± 0.6084.32 ± 0.39
GATPathLapPE (256 × 2)83.72 ± 0.6484.17 ± 0.3183.87 ± 0.6183.96 ± 0.5284.17 ± 0.31
GATPathLapPE84.39 ± 0.3983.93 ± 0.4884.20 ± 0.4583.97 ± 0.4884.39 ± 0.39
GATPathLapPE (EdgeSPE)83.80 ± 0.6183.90 ± 0.4283.69 ± 0.7683.54 ± 0.5483.90 ± 0.42
BiGATBase (No PE)90.36 ± 0.3090.36 ± 0.3090.36 ± 0.3090.36 ± 0.3090.36 ± 0.30
BiGATLaplacianPE91.15 ± 0.4091.03 ± 0.3990.97 ± 0.5991.06 ± 0.4491.15 ± 0.40
BiGATMulti-qq-MagLapPE q=0.05q = 0.0591.12 ± 0.3790.93 ± 0.2590.74 ± 0.6091.13 ± 0.4491.13 ± 0.44
BiGATMulti-qq-MagLapPE, q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}91.06 ± 0.4590.95 ± 0.4491.10 ± 0.4591.04 ± 0.3591.10 ± 0.45
BiGATPathLapPE (256 × 2)91.01 ± 0.3690.93 ± 0.4291.19 ± 0.3390.94 ± 0.4291.19 ± 0.33
BiGATPathLapPE90.99 ± 0.3490.91 ± 0.3791.07 ± 0.4491.10 ± 0.4691.10 ± 0.46
BiGATPathLapPE (EdgeSPE)90.95 ± 0.3591.05 ± 0.3690.91 ± 0.4991.14 ± 0.2791.14 ± 0.27
BiGCNBase (No PE)87.79 ± 0.4787.79 ± 0.4787.79 ± 0.4787.79 ± 0.4787.79 ± 0.47
BiGCNLaplacianPE89.31 ± 0.5189.58 ± 0.5789.40 ± 0.4189.46 ± 0.5389.58 ± 0.57
BiGCNMulti-qq-MagLapPE, q=0.05q = 0.0589.50 ± 0.5389.63 ± 0.3689.51 ± 0.3989.53 ± 0.5289.63 ± 0.36
BiGCNMulti-qq-MagLapPE, q∈{0.05,0.1,0.15}q \in\{0.05, 0.1, 0.15\}89.82 ± 0.3589.66 ± 0.3589.77 ± 0.5989.76 ± 0.4589.82 ± 0.35
BiGCNPathLapPE (256 × 2)90.14 ± 0.3190.24 ± 0.2890.21 ± 0.4090.20 ± 0.4890.24 ± 0.28
BiGCNPathLapPE90.22 ± 0.3490.24 ± 0.5690.29 ± 0.3290.23 ± 0.3290.29 ± 0.32
BiGCNPathLapPE (EdgeSPE)89.99 ± 0.4490.06 ± 0.4590.04 ± 0.4589.99 ± 0.4890.06 ± 0.45

Table 6. Results across encoder architectures and positional encodings on ROMAN-EMPIRE. Bold indicates the best kk for each variant. In the last column, the top three PEs for each encoder are denoted with gold, silver and bronze.

Finally, since PathLapPE provides two sets of encodings, node- and edge-level, we evaluate a more parameter-restricted version that maps each set of encodings to half of the node/edge hidden dimension of 512 before concatenation for a fairer comparison with the baselines; we denote this variant PathLapPE (256 ×\times 2). For model architectures and hyperparameter selection, we largely follow Platonov et al. [20]; full experimental details and selected hyperparameters are provided in Table 7.

Complete results. Here, we present the full set of results summarized in Table 2 of the main text. Specifically, we report results for all tested kk values; the final column (Best) corresponds to Table 2. The additional results demonstrate that (i) the superiority of PathLapPE is largely independent of the number of eigenvectors/eigenvalues considered, and that (ii) in almost all cases, the PEs are robust to the choice of kk, meaning that 8 or 16 is likely sufficient for Roman-Empire. Finally, restricting the dimensionality of PathLapPE encodings has no tangible drawback, as the two variants are always close and well within one standard deviation.

Open Circuit Benchmark & High-Level Synthesis

Open Circuit Benchmark (OCB) and High-Level Synthesis (HLS) are both inductive, graph-level benchmarks, with three regression tasks defined over each benchmark. For each task, we follow the implementations and optimized hyperparameters for BiGINE and GINE from Huang et al. [12], the latter operating on the undirected version of the graphs.

OCB (Dong et al., [3]) consists of 8,026 operational amplifier-based (op-amp) analog circuits as directed graphs, and the task is to predict DC gain (Gain), bandwidth (BW) and phase margin (PM) for each circuit. We evaluate two Multi-qq-MagLapPE configurations, each with ten qq values but with phase parameters of 0.01 and 0.05. Following Huang et al. [12], we use random 90/5/5% splits for training, validation and testing over three-stage amplifiers only.1

HLS (Wu et al., 2022) represents 18,570 C/C++ programs as directed intermediate representation (IR) graphs for performance analysis on FPGA integrated circuits. The task is to predict digital signal processor (DSP) and look-up table (LUT) usage, and critical path timing slack (CP, permitted delay that does not affect overall program runtime) for each program. We evaluate two Multi-qq-MagLapPE configurations, each with five qq values but with phase parameters of 0.01 and 0.1. We again follow Huang et al. [12] and randomly select 1,000 graphs each for validation and testing, and train on the remaining graphs.

Experimental setup. Hyperparameters for all OCB and HLS experiments are provided in Table 8 and 9, respectively. We observed several discrepancies between our results and those of Huang et al. [12]. Primarily, despite using the suggested optimized model hyperparameters and qq values, our Multi-qq-MagLapPE results were marginally worse than those reported in Huang et al. [12] on BiGINE, and significantly worse for GINE. For GINE in particular, Multi-qq-MagLapPE suffered from instabilities despite using five or ten qq values: some seeds converged to reasonable losses, while others fully diverged over the course of training, as indicated by high error values accompanied by extreme standard deviations. Finally, despite no additional tuning, we noted that our baseline No PE & LapPE configs for BiGINE ×\times LUT significantly outperformed the numbers reported in Huang et al. [12].

GAINBWPM
Data
Input node features3
Input edge features–
Graphs8,0268,0268,026
Splits90/5/5%90/5/5%90/5/5%
Batch size1286464
Optimization
OptimizerAdam (β1,β2=0.9,0.999\beta_1,\beta_2 = 0.9, 0.999)
Learning rate6.7⋅10−36.7 \cdot10^{-3}6.5⋅10−36.5 \cdot10^{-3}2.1⋅10−32.1 \cdot10^{-3}
Weight decay000
LR scheduleStepLR (step 100, γ=0.95\gamma= 0.95)
LossMSEMSEMSE
Max epochs300
Model selectionbest val. MSE checkpoint (no early stopping)
Backbone
Layers (pre / MP / post)1 / 4a^{a} / 31 / 3a^{a} / 21 / 4a^{a} / 4
Hidden dim. dd96192288
NormalizationBatchNorm (inside each conv MLP)
Dropout0.10.00.2
ActivationReLUReLUReLU
Poolingsumsumsum

Table 8. Key model and training hyperparameters for the OPEN CIRCUIT BENCHMARK experiments. All backbones (both uni- and bidirectional GINE) share a single configuration per target.

Further implementation details

Our codebase is based on PyTorch (Ansel et al., [1]), PyTorch Geometric (Fey et al., [6]), Hydra (Yadan, 2019) (released under an MIT license) and PyTorch Lightning (Falcon & The PyTorch Lightning team, [5]) (Apache 2.0 license).

The path complex construction was adapted from https://github.com/SteveHuntsmanBAESystems/PerformantPathHomology (CC BY-NC-SA 4.0 License). We also use the magnetic Laplacian and SPE implementations in https://github.com/Graph-COM/Multi-q-Maglap; we also extend their repository for our OCB and HLS evaluations. All experiments were conducted on NVIDIA L40S GPUs, with 8 CPUs and 48 GB RAM.

DSPDSPLUTLUTCPCP
Uni-GNNBi-GNNUni-GNNBi-GNNUni-GNNBi-GNN
Data
Categorical node features777777
Categorical edge features222222
Graphs (CDFG)18,57018,57018,57018,57018,57018,570
Splits16,570 / 1,000 / 1,00016,570 / 1,000 / 1,00016,570 / 1,000 / 1,00016,570 / 1,000 / 1,00016,570 / 1,000 / 1,00016,570 / 1,000 / 1,000
Batch size326432643264
Optimization
OptimizerAdam (β1\beta_1, β2\beta_2 = 0.9, 0.999)Adam (β1\beta_1, β2\beta_2 = 0.9, 0.999)Adam (β1\beta_1, β2\beta_2 = 0.9, 0.999)Adam (β1\beta_1, β2\beta_2 = 0.9, 0.999)Adam (β1\beta_1, β2\beta_2 = 0.9, 0.999)Adam (β1\beta_1, β2\beta_2 = 0.9, 0.999)
Learning rate5.92⋅10−35.92 \cdot10^{-3}3.10⋅10−33.10 \cdot10^{-3}1.50⋅10−31.50 \cdot10^{-3}2.30⋅10−32.30 \cdot10^{-3}5.92⋅10−35.92 \cdot10^{-3}3.10⋅10−33.10 \cdot10^{-3}
Weight decay000000
LR scheduleStepLR (step 100, γ\gamma = 0.95)StepLR (step 100, γ\gamma = 0.95)StepLR (step 100, γ\gamma = 0.95)StepLR (step 100, γ\gamma = 0.95)StepLR (step 100, γ\gamma = 0.95)StepLR (step 100, γ\gamma = 0.95)
LossMSEMSEMSEMSEMSEMSE
Max epochs400400400400400400
Backbone
Layers (pre / MP / post)1/2/21/4/31/4/21/4/21/2/21/4/3
Hidden dim. dd568484565684
NormalizationBatchNorm (inside each conv MLP)BatchNorm (inside each conv MLP)BatchNorm (inside each conv MLP)BatchNorm (inside each conv MLP)BatchNorm (inside each conv MLP)BatchNorm (inside each conv MLP)
Dropout0.10.20.30.10.10.2
ActivationReLUReLUReLUReLUReLUReLU
Poolingsumsumsumsummaxmax

Table 9. Key model and training hyperparameters for the HIGH-LEVEL SYNTHESIS experiments. Unlike OCB, the tuned configuration depends on whether the backbone is unidirectional (GINE) or bidirectional (BiGINE), so both are reported per target. A single value in a row indicates the parameter applies to all configurations.

Computational cost experiments

PathLapPE uses more memory than Multi-qq-MagLapPE, which processes qq values sequentially at fixed memory cost. For large graphs, sparse eigensolvers (Virtanen et al. (2020)) reduce this memory at a modest cost in time. Table 10 reports time and memory on our benchmarks; on the largest, ROMAN-EMPIRE (22,662 nodes), sparse PathLapPE takes three seconds and 70 MB, making computational costs negligible compared to training.

References

  1. [1]Jason Ansel, Edward Yang, Horace He, Natalia Gimelshein, Animesh Jain, Michael Voznesensky, Bin Bao, Peter Bell, David Berard, Evgeni Burkovski, Geeta Chauhan, Anjali Chourdia, Will Constable, Alban Desmaison, Zachary DeVito, Elias Ellison, Will Feng, Jiong Gong, Michael Gschwind, Brian Hirsh, Sherlock Huang, Kshiteej Kalambarkar, Laurent Kirsch, Michael Lazos, Mario Lezcano, Yanbo Liang, Jason Liang, Yinghai Lu, CK Luk, Bert Maher, Yunjie Pan, Christian Puhsrch, Matthias Reso, Mark Saroufim, Marcos Yukio Siraichi, Helen Suk, Michael Suo, Phil Tillet, Eikan Wang, Xiaodong Wang, William Wen, Shunting Zhang, Xu Zhao, Keren Zhou, Richard Zou, Ajit Mathews, Gregory Chanan, Peng Wu, and Soumith Chintala. PyTorch 2: Faster Machine Learning Through Dynamic Python Bytecode Transformation and Graph Compilation. In 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 2 (ASPLOS ’24). ACM, April 2024. doi: 10.1145/3620665.3640366. URL https://docs.pytorch.org/assets/pytorch2-2.pdf.DOI
  2. [2]Semih Cantürk, Renming Liu, Olivier Lapointe-Gagné, Vincent Létourneau, Guy Wolf, Dominique Beaini, and Ladislav Rampášek. Graph positional and structural encoder. In International Conference on Machine Learning, 2024.arxiv.org/abs/2307.07107
  3. [3]Zehao Dong, Weidong Cao, Muhan Zhang, Dacheng Tao, Yixin Chen, and Xuan Zhang. CktGNN: Circuit graph neural network for electronic design automation. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=NE2911Kq1sp.arxiv.org/abs/2308.16406
  4. [4]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.arxiv.org/abs/2110.07875
  5. [5]William Falcon and The PyTorch Lightning team. PyTorch Lightning, March 2019. URL https://github.com/Lightning-AI/lightning.DOI
  6. [6]Matthias Fey, Jinu Sunil, Akihiro Nitta, Rishi Puri, Manan Shah, Blaz Stojanovic, Ramona Bendias, Alexandria Barghi, Vid Kocijan, Zecheng Zhang, Xinwei He, Jan Eric Lenssen, and Jure Leskovec. PyG 2.0: Scalable Learning on Real World Graphs. Temporal Graph Learning Workshop @ KDD, 2025.arxiv.org/abs/2507.16991
  7. [7]Simon Geisler, Yujia Li, Daniel J Mankowitz, Ali Taylan Cemgil, Stephan Günnemann, and Cosmin Paduraru. Transformers meet directed graphs. In Andreas Krause, Emma Brunskill, KyungHyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 11144–11172. PMLR, 23–29 Jul 2023. URL https://proceedings.mlr.press/v202/geisler23a.html.arxiv.org/abs/2302.00049
  8. [8]Alexander Grigor’yan. Advances in path homology theory of digraphs. Notices of the International Consortium of Chinese Mathematicians, 10(2):61–124, 2022.DOI
  9. [9]Alexander Grigor’yan, Yong Lin, Yuri Muranov, and Shing-Tung Yau. Homotopy theory for digraphs. Pure and Applied Mathematics Quarterly, 10(4):619–674, 2014.
  10. [10]Alexander A Grigor’yan, Yong Lin, Yu V Muranov, and Shing-Tung Yau. Path complexes and their homologies. Journal of Mathematical Sciences, 248(5):564–599, 2020.DOI
  11. [11]Yinan Huang, William Lu, Joshua Robinson, Yu Yang, Muhan Zhang, Stefanie Jegelka, and Pan Li. On the stability of expressive positional encodings for graphs. In International Conference on Learning Representations, 2024.arxiv.org/abs/2310.02579
  12. [12]Yinan Huang, Haoyu Wang, and Pan Li. What are good positional encodings for directed graphs? In International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=s4Wm7LFFK4.arxiv.org/abs/2407.20912
  13. [13]Guillaume Jaume, An phi Nguyen, María Rodríguez Martínez, Jean-Philippe Thiran, and Maria Gabrani. eDGNN: a simple and powerful GNN for directed labeled graphs, 2019. URL https://arxiv.org/abs/1904.08745.
  14. [14]Niklas Kemper, Tom Wollschläger, and Stephan Günnemann. What expressivity theory misses: Message passing complexity for GNNs. In The Thirty-ninth Annual Conference on Neural Information Processing Systems, 2025. URL https://openreview.net/forum?id=ATYKjGdQt5.arxiv.org/abs/2509.01254
  15. [15]Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
  16. [16]Derek Lim, Joshua David Robinson, Lingxiao Zhao, Tess Smidt, Suvrit Sra, Haggai Maron, and Stefanie Jegelka. Sign and basis invariant networks for spectral graph representation learning. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=Q-UHqMorzil.
  17. [17]Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably powerful graph networks. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper_files/paper/2019/file/bb04af0f7ecaee4aae62035497da1387-Paper.pdf.arxiv.org/abs/1905.11136
  18. [18]Federico Monti, Karl Otness, and Michael M Bronstein. MotifNet: a motif-based graph convolutional network for directed graphs. In 2018 IEEE data science workshop (DSW), pp. 225–228. IEEE, 2018.
  19. [19]Hongbin Pei, Bingzhe Wei, Kevin Chen-Chuan Chang, Yu Lei, and Bo Yang. Geom-GCN: Geometric graph convolutional networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=S1e2agrFvS.arxiv.org/abs/2002.05287
  20. [20]Oleg Platonov, Denis Kuznedelev, Michael Diskin, Artem Babenko, and Ludmila Prokhorenkova. A critical look at the evaluation of GNNs under heterophily: Are we really making progress? In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=tJbQfFw-5wV.

AI tools statement

This work lists 1 AI tool.

  • Generative AI · AI tool

    Roles
    SoftwareVisualizationWriting — review & editing
    Verification
    self-declared at submission

Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type