Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
binomial_graph¶
-
binomial_graph
(n, p, seed=None, directed=False)¶ Return a random graph G_{n,p} (Erdős-Rényi graph, binomial graph).
Chooses each of the possible edges with probability p.
This is also called binomial_graph and erdos_renyi_graph.
Parameters: n : int
The number of nodes.
p : float
Probability for edge creation.
seed : int, optional
Seed for random number generator (default=None).
directed : bool, optional (default=False)
If True return a directed graph
See also
Notes
This is an O(n^2) algorithm. For sparse graphs (small p) see fast_gnp_random_graph for a faster algorithm.
References
[R307] - Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959).
[R308] - Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959).