rDAG: Generate a Directed Acyclic Graph (DAG) randomly
Description
This function randomly generates a Directed Acyclic Graph (DAG) with q nodes and probability of edge inclusion w.
Usage
rDAG(q, w)
Value
DAG \((q,q)\) adjacency matrix of the generated DAG
Arguments
q
number of nodes
w
probability of edge inclusion in \([0,1]\)
Details
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\).