2.4. igraph_erdos_renyi_game — Generates a random (Erdos-Renyi) graph.

int igraph_erdos_renyi_game(igraph_t *graph, igraph_erdos_renyi_t type,
			    igraph_integer_t n, igraph_real_t p_or_m,
			    igraph_bool_t directed, igraph_bool_t loops);

Arguments: 

graph:

Pointer to an uninitialized graph object.

type:

The type of the random graph, possible values:

IGRAPH_ERDOS_RENYI_GNM

G(n,m) graph, m edges are selected uniformly randomly in a graph with n vertices.

IGRAPH_ERDOS_RENYI_GNP

G(n,p) graph, every possible edge is included in the graph with probability p.

n:

The number of vertices in the graph.

p_or_m:

This is the p parameter for G(n,p) graphs and the m parameter for G(n,m) graphs.

directed:

Logical, whether to generate a directed graph.

loops:

Logical, whether to generate loops (self) edges.

Returns: 

Error code: IGRAPH_EINVAL: invalid type, n, p or m parameter. IGRAPH_ENOMEM: there is not enought memory for the operation.

Time complexity: O(|V|+|E|), the number of vertices plus the number of edges in the graph.

See also: 

igraph_barabasi_game(), igraph_growing_random_game()