rDAG {BCDAG} | R Documentation |
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)
Arguments
q |
number of nodes |
w |
probability of edge inclusion in |
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
.
Value
DAG (q,q)
adjacency matrix of the generated DAG
Examples
# 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)
[Package BCDAG version 1.1.1 Index]