NetworkX

Previous topic

networkx.generators.random_graphs.gnp_random_graph

Next topic

networkx.generators.random_graphs.dense_gnm_random_graph

networkx.generators.random_graphs.directed_gnp_random_graph

directed_gnp_random_graph(n, p, create_using=None, seed=None)

Return a directed random graph.

Chooses each of the possible n(n-1) edges with probability p.

This is a directed version of G_np.

Parameters:

n : int

The number of nodes.

p : float

Probability for edge creation.

create_using : graph, optional (default DiGraph)

Use specified graph as a container.

seed : int, optional

Seed for random number generator (default=None).

Notes

This is an O(n^2) algorithm.

References

[R68]
  1. Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959).
[R69]
    1. Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959).