igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] BFS of a certain number of steps


From: Ragia Ibrahim
Subject: Re: [igraph] BFS of a certain number of steps
Date: Fri, 21 Feb 2014 10:37:22 +0200

might help


http://www.cs.rutgers.edu/~mlittman/courses/cs105-06b/lectures/10graphs.pdf






RAE


> Date: Fri, 21 Feb 2014 09:05:29 +0100
> From: address@hidden
> To: address@hidden; address@hidden
> Subject: Re: [igraph] BFS of a certain number of steps
>
> It takes <10 lines of Python code to do that so it’s unlikely that we’ll provide a separate function for that. Something along the lines of:
>
> import random, itertools
>
> def random_walk_iterator(graph, v):
> while True:
> yield v
> v = random.choice(graph.neighbors(v))
>
> walk = itertools.islice(random_walk_iterator(graph, start), desired_length)
>
> Note that you need extra care in random_walk_iterator when the graph is directed because you have to handle cases when you get stuck in a dead end.
>
> --
> T.
>
>
> On Friday, 21 February 2014 at 06:11, Ahmed Abdeen Hamed wrote:
>
> > It would be ideal if I can do a random walk that starts with a vertex and randomly selects the next node until the path lengths is satisfied. I tried community_walktrap() but it doesn't seem to be giving me what I need.
> >
> > -Ahmed
> >
> >
> >
> > On Thu, Feb 20, 2014 at 11:38 PM, Ahmed Abdeen Hamed <address@hidden (mailto:address@hidden)> wrote:
> > > Hello friends,
> > >
> > > How can I perform graph traversal using BFS with a certain number of steps? Say I want start start with a source node s and then step when I find n number of traversed vertices?
> > >
> > > Much appreciated!
> > >
> > > -Ahmed
> > _______________________________________________
> > igraph-help mailing list
> > address@hidden (mailto:address@hidden)
> > https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

[Prev in Thread] Current Thread [Next in Thread]