No, there isn't, as far as I know. If you are using igraph from Python, here's a quick implementation of a random walk iterator:
import random def random_walk(g, start=None): current = random.randint(0, g.vcount()-1) if start is None else start stop = False while not stop: stop = yield current current = random.choice(g.successors(current)) You can then combine this with itertools.islice() to get a random walk with a given length: vs = list(islice(random_walk(g, start=5), desired_length)) and then you can take the subgraph: g2 = g.induced_subgraph(vs) But the iterator also lets you stop the random walk when you reach a given vertex if you combine it with itertools.takewhile() instead: destination = 20 vs = list(takewhile(lambda x: x != destination, random_walk(g, start=5))) + [destination] -- T. ------------------------------------------------------ From: Николай Кинаш [email protected] Reply: Help for igraph users [email protected] Date: 10 July 2014 at 05:33:47 To: [email protected] [email protected] Subject: [igraph] sample graph via random walk > Hi all. > > Is there a built-in function to get subgraph from random walk on graph? > > Thanks. > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
