networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
random_uniform_k_out_graph(n, k, self_loops=True, with_replacement=True, seed=None)

A random k-out graph with uniform attachment is a multidigraph generated by the following algorithm. For each node u, choose k nodes v uniformly at random (with replacement). Add a directed edge joining u to v.

Notes

The return digraph or multidigraph may not be strongly connected, or even weakly connected.

If :None:None:`with_replacement` is True, this function is similar to random_k_out_graph , if that function had parameter alpha set to positive infinity.

Parameters

n : int

The number of nodes in the returned graph.

k : int

The out-degree of each node in the returned graph.

self_loops : bool

If True, self-loops are allowed when generating the graph.

with_replacement : bool

If True, neighbors are chosen with replacement and the returned graph will be a directed multigraph. Otherwise, neighbors are chosen without replacement and the returned graph will be a directed graph.

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> .

Raises

ValueError

If :None:None:`with_replacement` is False and k is greater than n.

Returns

NetworkX graph

A k-out-regular directed graph generated according to the above algorithm. It will be a multigraph if and only if :None:None:`with_replacement` is True.

Returns a random k-out graph with uniform attachment.

See Also

random_k_out_graph

Examples

See :

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/generators/directed.py#330
type: <class 'function'>
Commit: