get_expected_density#

get_expected_density(average_degree, n_nodes)[source]#

Calculate the expected density of an undirected graph with no self-loops given graph properties. The expected density of an undirected graph with no self-loops is defined as the number of edges as a fraction of the number of maximal edges possible.

Reference: Newman, M. E. J. (2010). Networks: An Introduction (pp 134-135). Oxford University Press.

Parameters:
  • average_degree (float) – average expected degree

  • n_nodes (int) – number of nodes in the graph

Returns:

The expected graph density.

Return type:

float