On 12.09.2017 17:30, balazshoranyi01 wrote:
> Hi There,
> 
> I was wondering what your thoughts were on the fastest way to get a random
> neighbor of a vertex?
> Right now I am doing something like:
> /        outid = G.get_out_neighbours(v)
>         outid = random.choice(outid)/
> 
> I'm trying to implement a type of random walk and have the above code
> wrapped in a for loop ~ 100000 iterations. Is there a better way to
> implement this?

It is hard to suggest an improvement without further context. The first line
is O(k) and the second is O(1), and they both are the best you can get.


-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to