py_random_state(random_state_argument)
The decorator processes the argument indicated by :None:None:`random_state_argument`
using nx.utils.create_py_random_state
. The argument value can be a seed (integer), or a random number generator:
If int, return a random.Random instance set with seed=int. If random.Random instance, return it. If None or the `random` package, return the global random number generator used by `random`. If np.random package, return the global numpy random number generator wrapped in a PythonRandomInterface class. If np.random.RandomState instance, return it wrapped in PythonRandomInterface If a PythonRandomInterface instance, return it
The name of the argument or the index of the argument in args that is to be converted to the random.Random instance or numpy.random.RandomState instance that mimics basic methods of random.Random.
Function whose random_state_argument is converted to a Random instance.
Decorator to generate a random.Random instance (or equiv).
@py_random_state("random_state") def random_float(random_state=None): return random_state.rand()
@py_random_state(0) def random_float(rng=None): return rng.rand()
See :@py_random_state(1) def random_array(dims, seed=12345): return seed.rand(*dims)
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.utils.decorators.np_random_state
networkx.utils.decorators.argmap
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them