Abstract: Node embeddings are a paradigm in non-parametric graph representation learning, where graph nodes are embedded into a given vector space to enable downstream processing. State-of-the-art node-embedding algorithms, such as DeepWalk and node2vec, are based on random-walk notions of node similarity and on contrastive learning. In this work, we introduce the graph neighbor-embedding (graph NE) framework that directly pulls together embedding vectors of adjacent nodes without relying on any random walks. We show that graph NE strongly outperforms state-of-the-art node-embedding algorithms in terms of local structure preservation. Furthermore, we apply graph NE to the 2D node-embedding problem, obtaining graph t-SNE layouts that also outperform existing graph-layout algorithms.
Introduction
In the field of graph representation learning, the dominant paradigm has long relied on a linguistic metaphor: nodes are treated as words, and random walks across a graph are treated as sentences. This conceptual framework underpins influential algorithms like DeepWalk and node2vec, which leverage these "sentences" to train embeddings using word2vec-style contrastive learning.
However, recent research published in Transactions on Machine Learning Research (11/2025) challenges the necessity of random walks. The authors introduce Graph Neighbor Embedding (graph NE), a framework that simplifies the process by directly optimizing for the proximity of adjacent nodes in the embedding space. By bypassing the computational overhead and hyperparameter complexity of random walks, graph NE offers a more direct and efficient approach to preserving a graph's intrinsic local structure.
The Graph Neighbor Embedding Framework
Graph NE treats node embedding as a neighbor-embedding problem, similar to dimensionality reduction techniques like t-SNE or UMAP. The framework adapts its optimization strategy based on the target dimensionality of the embedding:
- High-Dimensional Embeddings (e.g., 128D): The framework utilizes the InfoNCE loss, a standard in contrastive learning. In this setup, adjacent nodes are treated as "positive pairs," while all other nodes are considered "negative pairs."
- 2D Graph Layouts: For visualization purposes, the framework employs KL divergence—the loss function behind t-SNE—combined with a Cauchy similarity kernel.
A critical component of the framework is data preparation. For 2D layouts, row-normalizing the adjacency matrix is essential to prevent low-degree nodes from being isolated at the periphery of the visualization. For high-dimensional embeddings, the choice of temperature ($\tau$) in the loss function proves to be a decisive factor in performance.
The Role of Temperature in Local Structure Preservation
One of the paper's most significant technical insights is the impact of the temperature parameter ($\tau$) in contrastive learning. While a default temperature (e.g., $\tau=0.5$) might suffice for general node classification, it often fails to preserve fine-grained local structures.
The authors discovered that significantly lowering the temperature (e.g., to $\tau=0.05$) makes the model "sharper." This sharpening effect allows the model to effectively ignore the "noise" of rare inter-cluster edges, focusing instead on the core community structure. As shown in the benchmarking results, this adjustment is vital for maximizing neighbor recall—the ability of the embedding to accurately reflect a node's actual graph neighbors.
Experimental Results
The authors evaluated graph NE across eight diverse datasets, including citation networks (Citeseer, Cora, PubMed, arXiv), product/social graphs (Photo, Computer, MAG), and synthetic image-derived graphs (MNIST kNN). These datasets range in scale from approximately 2,000 nodes to over 700,000 nodes.
Key findings include:
- Superior Local Structure: Graph NE outperformed DeepWalk and node2vec in neighbor recall on 7 out of 8 datasets, with an average improvement of 13.4 percentage points.
- Competitive Classification: Despite its focus on local structure, graph NE remained highly competitive in node classification tasks, matching or exceeding the performance of more complex, random-walk-based methods.
- Enhanced Visualizations: In 2D, the "graph t-SNE" layouts produced by graph NE showed superior cluster separation compared to traditional tools like ForceAtlas2.
- Efficiency: The algorithm scales linearly with the number of edges, making it efficient for large-scale graphs with millions of edges.
Conclusion and Future Work
Graph NE demonstrates that the "local smoothing" provided by random walks is often redundant and can even be detrimental to preserving fine-grained neighborhood details. By unifying high-dimensional embedding and 2D layout under a single neighbor-embedding framework, the authors provide a simpler, more effective tool for graph representation.
Currently, graph NE is a non-parametric method, meaning it does not incorporate node features or handle out-of-sample nodes easily. Future research aims to develop a parametric version using Graph Convolutional Networks (GCNs), which would combine the structural preservation of graph NE with the feature-processing capabilities of deep learning.
Summary updated