# Random Erdős–Rényi network#

## Undirected Erdős–Rényi network#

random_gnp_graph[vert_type](size: int, p: float,    random_state) -> undirected_network[vert_type]
template<integer_network_vertex VertT, std::uniform_random_bit_generator Gen>
undirected_network<VertT> random_gnp_graph(VertT size, double p, Gen &generator)#

Generates a random $$G(n = size, p)$$ graph of size size, where every edge exists independently with probability p .

The expected number of edges is $$p \frac{n (n-1)}{2}$$.

If the parameter p is not in the $$[0, 1]$$ range, the function fails by raising a ValueError exception in Python or a std::invalid_argument exception in C++.

## Directed Erdős–Rényi network#

random_directed_gnp_graph[vert_type](size: int, p: float,    random_state) -> directed_network[vert_type]
template<integer_network_vertex VertT, std::uniform_random_bit_generator Gen>
directed_network<VertT> random_directed_gnp_graph(VertT size, double p, Gen &generator)#

Generates a random directed $$G(n = size, p)$$ graph of size size, where every directed edge exists independently with probability p .

Note that unlike in an undirected network $$(i, j)$$ and $$(j, i)$$ are distinct edges in a directed network, so the expected number of edges is $$p n (n-1)$$

If the parameter p is not in the $$[0, 1]$$ range, the function fails by raising a ValueError exception in Python or a std::invalid_argument exception in C++.