In the GDS, random walks through a projected graph can be generated using the gds.alpha.randomwalk procedure in the following way (still using the karateclub graph from the previous sections as an example):
MATCH (n:Node {id: 1})
CALL gds.alpha.randomWalk.stream({
nodeProjection: "*",
relationshipProjection: {
LINKED_TO: {
type: "LINK",
orientation: "UNDIRECTED"
}
},
start: id(n),
walks: 1,
steps: 2
})
YIELD nodeIds
RETURN nodeIds
You can recognize the parameters we have already encountered earlier, to configure the number of walks (here it is equal to 1) and the number of hops to perform (equal to 2 in the preceding query).
The result of the preceding query is a list of node IDs similar to the following:
╒═════════╕
│"nodeIds"│
╞════...