rDAG {BCDAG} | R Documentation |
This function randomly generates a Directed Acyclic Graph (DAG) with q
nodes and probability of edge inclusion w
.
rDAG(q, w)
q |
number of nodes |
w |
probability of edge inclusion in |
The 0-1
adjacency matrix of the DAG is generated by drawing each element in the lower triangular part in {0,1}
with probability {1-w, w}
.
Accordingly, the DAG has lower-triangular adjacency matrix and nodes are numerically labeled according to a topological ordering implying u > v
whenever u -> v
.
DAG (q,q)
adjacency matrix of the generated DAG
# Randomly generate a DAG on q = 8 nodes with probability of edge inclusion w = 0.2
q = 8
w = 0.2
set.seed(123)
rDAG(q = q, w = w)