This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
gnp_random_graph(n, p, seed=None, directed=False)¶
Returns a random graph, also known as an Erdős-Rényi graph or a binomial graph.
The model chooses each of the possible edges with probability
This algorithm runs in time. For sparse graphs (that is, for small values of ),
fast_gnp_random_graph()is a faster algorithm.
- Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959).
- Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959).