Abstract
Despite Graph Neural Networks' (GNNs) achievements in graph representation learning tasks, how to learn the deterministic node position embedding in non-Euclidean graph data is still an open question. Additionally, most existing message-passing-based graph neural networks' expressive power is commonly limited by the 1-Weisfeiler-Lehman (1-WL) graph isomorphism test. Many works have recently proposed different ideas to solve the above two problems separately. However, they cannot guarantee all-level tasks generalization, intense expressiveness, and efficient reasoning on all graph tasks simultaneously. In this work, we connect these lines of inquiry to propose a plug-in Equivariant Distance ENcoding (EDEN). EDEN is derived from a series of interpretable transformations on the graph's distance matrix. We theoretically prove that EDEN is permutation-equivariant for all level graph learning task generalization, and we empirically illustrate that EDEN's expressive power can reach up to the 3-WL test. Extensive experiments on real-world datasets show that combining EDEN with conventional GNNs surpasses recent advanced GNNs and position encodings at the same or lower computational complexity.
Introduction
Standard Message-Passing Neural Networks (MPNNs) are the primary tools for graph learning, yet they face two significant hurdles: a lack of global structural awareness and the absence of a natural coordinate system. MPNNs are typically bounded by the 1-Weisfeiler-Lehman (1-WL) test, meaning they cannot distinguish between certain non-isomorphic graphs. Furthermore, unlike grid-based data like images, graphs lack inherent node coordinates, making it difficult for models to understand relative positioning and global topology.
Previous attempts to provide nodes with "coordinates" (positional encodings) often relied on random anchors, which hinders generalization to unseen graphs. Other methods, such as those based on Laplacian eigenvectors, are computationally intensive and prone to "over-smoothing," where node encodings in local clusters become indistinguishable. To address these challenges, we introduce EDEN (Equivariant Distance ENcoding), a deterministic, "plug-and-play" extension that provides nodes with a global sense of position while breaking the 1-WL expressiveness barrier.
The EDEN Framework
EDEN generates deterministic and permutation-equivariant encodings by leveraging the graph's internal geometry through a three-step process:
- Distance Matrix Calculation: The shortest path distance $D_{i,j}$ is computed for all node pairs.
-
Phase Propagation: To normalize distances, they are mapped into a "phase" using a cosine function: $$\hat{D}_{i,j} = \cos\left(\pi \times \frac{D_{i,j}}{d_i}\right)$$ where $d_i$ represents the diameter (maximum distance) from node $i$. This maps distances into the $[-1, 1]$ range, ensuring a consistent scale across different graph sizes.
-
Dimensionality Reduction: The resulting $N \times N$ matrix is compressed into a low-dimensional $N \times k$ vector using Principal Component Analysis (PCA).
A key theoretical contribution of this work is the proof that this pipeline is permutation-equivariant. This ensures that the learned encodings reflect structural properties rather than arbitrary node indexing, allowing for robust generalization across different graph instances.
Performance and Expressivity
We evaluated EDEN across various benchmarks, focusing on graph isomorphism and real-world predictive tasks.
Breaking the 1-WL Barrier
On the GRAPH8C dataset, which contains 61 million pairs of graphs, a standard Graph Isomorphism Network (GIN) enhanced with EDEN achieved zero misjudged pairs. In contrast, the baseline GIN failed on 386 pairs. This empirical evidence suggests that EDEN's expressive power reaches the 3-WL level, significantly surpassing standard MPNNs.
Real-World Benchmarks
EDEN was tested on citation networks (Cora, CiteSeer), bio-informatics (ENZYMES, PROTEINS), and chemical datasets (MUTAG).
- Accuracy Improvements: On the ENZYMES dataset, adding EDEN to a standard Graph Convolutional Network (GCN) increased classification accuracy from 65.7% to 86.9%.
- Structural Separation: Visualization of Zachary’s Karate Club network demonstrated that EDEN maps nodes into a space where communities are linearly separable, outperforming traditional Laplacian-based positional encodings.
Conclusion
EDEN provides a powerful and efficient way to incorporate global positional information into GNNs. By treating the encoding as a static pre-computed feature, it enables standard models to achieve high-order expressivity. While the $O(N^3)$ complexity of the initial distance matrix calculation remains a bottleneck for massive graphs, EDEN represents a significant step toward deterministic and equivariant node positioning in graph representation learning.
Summary updated