NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

node2vec: Scalable Feature Learning for Networks

Aditya Grover, Jure Leskovec

Abstract

node2vec is a flexible, scalable framework for learning continuous feature representations for nodes in a network. By employing a novel biased random walk procedure, it allows for a tunable exploration of a node's neighborhood, effectively capturing both local community structures (homophily) and broader structural roles (structural equivalence). This approach significantly outperforms previous "rigid" methods like DeepWalk across various machine learning tasks on graphs.

Introduction

Machine learning on networks, such as social graphs or biological pathways, necessitates robust feature representations for nodes. Historically, these features were hand-engineered—a process that is both tedious and often fails to generalize across different domains. While representation learning emerged to automate this, early techniques like DeepWalk were limited by rigid sampling strategies that could not account for the different ways nodes can be "similar."

Methodology

The node2vec framework formulates representation learning as a maximum likelihood optimization problem, similar to the Skip-gram model used in natural language processing. The objective is to learn a mapping that maximizes the probability of predicting a node’s neighborhood based on its embedding.

The core innovation is the biased 2nd-order random walk. Unlike uniform walks, node2vec uses two hyperparameters to control exploration:

  • Return parameter ($p$): Controls the likelihood of immediately revisiting a node.
  • In-out parameter ($q$): Controls the bias between "inward" and "outward" movement.
Transition probabilities for the biased random walk, showing the influence of parameters p and q.

By tuning $p$ and $q$, the algorithm can interpolate between Breadth-First Search (BFS), which captures structural equivalence and local roles, and Depth-First Search (DFS), which captures homophily and macro-community structures. This flexibility allows node2vec to find the optimal balance for a specific dataset.

Experimental Results

The authors evaluated node2vec on diverse real-world networks, including BlogCatalog (social), Protein-Protein Interactions (biological), and Wikipedia (word co-occurrence). The performance was measured using Micro-F1 and Macro-F1 scores for multi-label classification tasks.

Performance comparison of node2vec against Spectral Clustering, DeepWalk, and LINE across three datasets.

As shown in the results, node2vec consistently outperforms baselines. For instance, on the BlogCatalog dataset, it achieved a 26.7% improvement over the next best method. The algorithm also excels in link prediction tasks and demonstrates linear scalability, processing a million-node network in under four hours. It remains robust even when a large portion of the network's edges are missing or noisy.

Conclusion

node2vec provides a powerful and flexible solution for learning network embeddings. Its ability to unify BFS and DFS strategies into a single tunable framework makes it highly adaptable to different network types and tasks. Future research may extend this to heterogeneous and dynamic graphs, further broadening its applicability in complex real-world scenarios.

Summary updated

BibTeX
@inproceedings{grover2016node,
  author = {Aditya Grover and Jure Leskovec},
  title = {{node2vec: Scalable Feature Learning for Networks}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2016},
  url = {https://openreview.net/forum?id=SJN0RXWubH},
}
Figure