Fastest way to get a random neighbor

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.