NetworkX

Previous topic

networkx.erdos_renyi_graph

Next topic

networkx.newman_watts_strogatz_graph

Quick search

networkx.binomial_graph

binomial_graph(n, p, seed=None)

Return a random graph G_{n,p}.

Choses each of the possible [n(n-1)]/2 edges with probability p. This is the same as binomial_graph and erdos_renyi_graph.

Sometimes called Erdős-Rényi graph, or binomial graph.

Parameters:
  • n: the number of nodes
  • p: probability for edge creation
  • seed: seed for random number generator (default=None)

This is an O(n^2) algorithm. For sparse graphs (small p) see fast_gnp_random_graph.

P. Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959). E. N. Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959).