Learn R Programming

sparsebnUtils (version 0.0.8)

random.dag: Generate random DAGs

Description

Generate a random DAG with fixed number of edges.

Usage

random.dag(nnode, nedge, FUN = NULL, permute = TRUE)

Arguments

nnode

Number of nodes in the DAG.

nedge

Number of edges in the DAG.

FUN

Optional function to be used as a random number generator.

permute

If TRUE, order of nodes will be randomly permuted. If FALSE, output will be ordered according to its topological sort, i.e. with a lower-triangular adjacency matrix.

Value

An (weighted) adjacency matrix.

Details

FUN can be any function whose first argument is called n. This allows for both random and deterministic outputs.