node2vec — Talks, Press, and Discussion
Press & Blog Coverage
-
node2vec project page, Stanford SNAP. The authors’ page for the paper, with code and data.
-
aditya-grover/node2vec, GitHub. The reference implementation “of node2vec as described in the paper”.
-
Node2Vec in PyTorch Geometric, documentation. A library implementation with the walk length, context size and p, q parameters from the paper.
Q&A (answers from the paper)
Q1: What is the difference between homophily and structural equivalence? Under homophily, nodes in the same tightly connected community should get similar vectors. Under structural equivalence, nodes with the same role, such as two hubs in different communities, should get similar vectors (Section 3.1, Figure 1).
Q2: What do p and q do? A high p (above max(q, 1)) makes the walk less likely to go straight back, which encourages moderate exploration; a low p keeps the walk local. q > 1 biases the walk towards nodes close to the previous node (BFS-like); q < 1 pushes it outward (DFS-like) (Section 3.2.2).
Q3: How is node2vec related to DeepWalk? DeepWalk samples uniform random walks, which is the special case p = 1 and q = 1 (Section 4.2). On Wikipedia, node2vec’s learned exploration gave a Macro-F1 gain of 21.8% over DeepWalk (Section 4.3, Table 2).
Q4: How are p and q chosen? By a grid search over p, q ∈ {0.25, 0.5, 1, 2, 4} with 10-fold cross-validation on 10% labelled data (Section 4.2).
Q5: How does node2vec stay fast? Transition probabilities are precomputed, so each walk step takes O(1) time with alias sampling, and the three phases (preprocessing, walks, SGD) can each be parallelised (Section 3.2.3).
Q6: Can node2vec predict links? Yes. Two node vectors are combined into an edge feature with an operator such as the average or the Hadamard product (Section 3.3, Table 1). The paper reports gains of up to 12.6% on link prediction (Section 1).
Common Misconceptions
-
“q < 1 means BFS.” Correction: q > 1 gives BFS-like walks that stay near the previous node; q < 1 gives DFS-like walks that move outward (Section 3.2.2).
-
“node2vec always beats DeepWalk by a lot.” Correction: on PPI the Macro-F1 gain over the best baseline was 1.3%, against 22.3% on BlogCatalog and 21.8% on Wikipedia (Section 4.3, Table 2).
-
“node2vec is a graph neural network.” Correction: it learns one free vector per node with a Skip-gram objective on sampled walks; there is no message passing over node features (Section 3).
-
“The notebook shows q = 0.5 recovers communities much better.” Correction: over 5 seeds both settings reached NMI 1.000 on the notebook’s small graph; only the silhouette score differed slightly (0.361 vs 0.315).
Real Citations
- Grover, A., & Leskovec, J. (2016). node2vec: Scalable Feature Learning for Networks. KDD 2016. arXiv:1607.00653.
- Perozzi, B., Al-Rfou, R., & Skiena, S. (2014). DeepWalk: Online Learning of Social Representations. KDD 2014. (Uniform walks; the case p = q = 1)
- Tang, J., Qu, M., Wang, M., Zhang, M., Yan, J., & Mei, Q. (2015). LINE: Large-scale Information Network Embedding. WWW 2015. (Baseline)
- Mikolov, T., Sutskever, I., Chen, K., Corrado, G., & Dean, J. (2013). Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013. (Skip-gram with negative sampling)