networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
np_random_state(random_state_argument)

The decorator processes the argument indicated by :None:None:`random_state_argument` using nx.utils.create_random_state . The argument value can be a seed (integer), or a numpy.random.RandomState instance or (:None:None:`None` or numpy.random ). The latter options use the glocal random number generator used by numpy.random . The result is a numpy.random.RandomState instance.

Parameters

random_state_argument : string or int

The name or index of the argument to be converted to a numpy.random.RandomState instance.

Returns

_random_state : function

Function whose random_state keyword argument is a RandomState instance.

Decorator to generate a numpy.random.RandomState instance.

See Also

py_random_state

Examples

@np_random_state("seed") def random_float(seed=None): return seed.rand()

@np_random_state(0) def random_float(rng=None): return rng.rand()

@np_random_state(1) def random_array(dims, random_state=1): return random_state.rand(*dims)

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.utils.decorators.py_random_state

Local connectivity graph

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


GitHub : /networkx/utils/decorators.py#315
type: <class 'function'>
Commit: