A random walk traverses a graph by repeatedly moving from the current node to a neighboring node. In node2vec, these walks become sentences for the word2vec skip-gram model, turning graph structure into training data for node embeddings. section 9.3.2
A practical random-walk workflow follows these ideas:
- Choose a walk length; each visited node becomes a word, and each walk becomes a sentence. section 9.3.2
- Start walks from every node so the generated sentences can capture the whole graph. section 9.3.2
- Use first-order transitions when the next step depends only on the current node; node2vec instead uses second-order walks that also consider the previous step. section 9.3.2
- For weighted graphs, calculate a connection’s traversal chance as its weight divided by the sum of neighboring weights. section 9.3.2
Turning a walk into a sentence
A walk might start at node A and reach node H through C, B, and F. The sequence A–C–B–F–H becomes a sentence-like training example for the skip-gram model. section 9.3.2
Use the figure to follow how a graph traversal becomes a sentence for node embedding training. section 9.3.2


