causally.graph.random_graph.BarabasiAlbert
- class causally.graph.random_graph.BarabasiAlbert(num_nodes: int, expected_degree: int, preferential_attachment_out: bool = True, min_num_edges: int = 2)
Generator of Scale Free directed acyclic graphs.
This class is a wrapper of the Barabasi graph sampler of the
igraphPython packege.- Parameters:
num_nodes (int) – Number of nodes.
expected_degree (int) – Expected degree of each node. The value provided must be greater or equal than 1.
preferential_attachment_out (bool, default True) – Select whether new nodes are connected to existing nodes by incoming or outcoming edges. If True, new nodes have higher probability of incoming edges from existing nodes with high out-degree. Else, new nodes tend to have outcoming edges towards existing nodes with high in-degree.
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.
Methods
Sample a random directed acyclic graph (DAG).