causally.graph.random_graph.ErdosRenyi

class causally.graph.random_graph.ErdosRenyi(num_nodes: int, expected_degree: int | None = None, p_edge: float | None = None, min_num_edges: int = 2)

Generator of Erdos-Renyi directed acyclic graphs.

This class is a wrapper of the Erdos-Renyi graph sampler of the igraph Python packege.

Parameters:
  • num_nodes (int) – Number of nodes.

  • expected_degree (int, default None) – Expected degree of each node. The value provided must be greater or equal than 1.

  • p_edge (float, default None) – Probability of edge between each pair of nodes. Accepted values are in the range (0.1, 1]

  • min_num_edges (int, default 2) – The minimum number of edges required in the graph. If 0, allows for empty graphs. The maximum value allowed is num_nodes * (num_nodes - 1) / 2, corresponding to a DAG with all nodes connected.

Notes

One and only one parameter between expected_degree and p_edge must be explicitly provided.

Methods

get_random_graph()

Sample a random directed acyclic graph (DAG).