0

Hello there is a python implementation of igraph_random_walk available in the r version?

If is not available How can I easly develop one random walk function using igraph?

Hope someone will help me.

emanuele
  • 1
  • 1

1 Answers1

0

There seems not to be a Python equivalent implementation. But you can easily implement it on your own. Take the same method signature

random_walk(graph, start, steps, mode = c("out", "in", "all"), stuck = c("return", "error"))

(or simplify it to your needs) and use the random package, e.g.

random.randint(1, n_neighbors)

where n_neighbors is the number of neighbors the current node has. Then move on to the chosen node and call the same function recursively with steps-1.

WolfgangM
  • 243
  • 2
  • 14