VHRanger / CSRGraph

A tiny library for large graphs
MIT License
111 stars 17 forks source link

add np.random.default_rng() to random_walks.py #25

Closed rtbs-dev closed 9 months ago

rtbs-dev commented 9 months ago

Allows the new numpy generator (which is now preferred by numpy).

Will also (indirectly) let users pass a custom RNG (e.g. for reproducibility, which is my use-case).

rtbs-dev commented 9 months ago

@VHRanger to work like the networkx counterpart, the seed argument accepts a numpy generator (even though the seed is actually the integer). Happy to rename/rework, as needed.

If a user doesn't pass a custom generator to G.random_walks(), no functionality should change, since I've set everything to use np.random.default_rng() via a global DEFAULT_RNG var in your random_walks.py.

I believe this should still be ok with numba compilation...?