Erdős–Rényi graphs

The Erdős–Rényi model sets an edge between each pair of vertices with equal probability, independently of the other edges.

erdos_renyi_graph(g, n, p[; has_self_loops=false])

Add edges between vertices 1:n of graph g randomly, adding each possible edge with probability p independently of all others.

Parameters:
  • g – the input graph
  • n – the number of vertices between which to add edges
  • p – the probability with which to add each edge
  • has_self_loops – whether to consider edges v -> v.
Returns:

the graph g.

erdos_renyi_graph(n, p[, has_self_loops=false])

Convenience function to construct an n-vertex Erdős–Rényi graph as an incidence list.