randomDag: Random directed acyclic graph

Description Usage Arguments Details Value Author(s) Examples

Description

Generate a random directed acyclic graph (DAG)

Usage

1
random_dag(V, maxpar = 3, wgt = 0.1)

Arguments

V

The set of vertices.

maxpar

The maximum number of parents each node can have

wgt

A parameter controlling how likely it is for a node to have a certain number of parents; see 'Details'

Details

If the maximum number of parents for a node is, say 3 and wgt=0.1, then the probability of the node ending up with 0,1,2,3 parents is proportional to 0.1^0, 0.1^1, 0.1^2, 0.1^3.

Value

A graphNEL object.

Author(s)

S<f8>ren H<f8>jsgaard, sorenh@math.aau.dk

Examples

1
2
3
4
5
6
7
8
dg   <- random_dag(1:1000, maxpar=5, wgt=.9)
table(sapply(vpar(dg),length))

dg   <- random_dag(1:1000, maxpar=5, wgt=.5)
table(sapply(vpar(dg),length))

dg   <- random_dag(1:1000, maxpar=5, wgt=.1)
table(sapply(vpar(dg),length))

gRbase documentation built on May 2, 2019, 4:51 p.m.