sim_dag: Simulate a Random DAG

View source: R/simulation.R

sim_dagR Documentation

Simulate a Random DAG

Description

Simulates a random directed acyclic graph adjacency (DAG) matrix with n nodes and either m edges, edge creation probability p, or edge creation probability range p_range.

Usage

sim_dag(n, m = NULL, p = NULL)

Arguments

n

The number of nodes.

m

Integer in ⁠0, n*(n-1)/2⁠. Number of edges in the graph. Exactly one of m or p must be supplied.

p

Numeric in ⁠[0,1]⁠. Probability of edge creation. Exactly one of m or p must be supplied.

Value

The sampled caugi object.

See Also

caugi::generate_graph()

Examples

# Simulate a DAG with 5 nodes and 3 edges
sim_dag(n = 5, m = 3)

# Simulate a DAG with 5 nodes and edge creation probability of 0.2
sim_dag(n = 5, p = 0.2)


causalDisco documentation built on April 13, 2026, 5:06 p.m.