graph generation utilities {bnlearn}R Documentation

Generate empty or random graphs

Description

Generate empty or random directed acyclic graphs from a given set of nodes.

Usage

empty.graph(nodes, num = 1)
random.graph(nodes, num = 1, method = "ordered", ..., debug = FALSE)

Arguments

nodes

a vector of character strings, the labels of the nodes.

num

an integer, the number of graphs to be generated.

method

a character string, the label of a score. Possible values are ordered (full ordering based generation), ic-dag (Ide's and Cozman's Generating Multi-connected DAGs algorithm), melancon (Melancon's and Philippe's Uniform Random Acyclic Digraphs algorithm) and empty (generates empty graphs).

...

additional tuning parameters (see below).

debug

a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is completely silent. Ignored in some generation methods.

Details

Available graph generation algorithms are:

Additional arguments for the random.graph function are:

Value

Both empty.graph() and random.graph() return an object of class bn (if num is equal to 1) or a list of objects of class bn (otherwise). If every is greated than 1, random.graph always returns a list, regardless of the number of graphs it contains.

Author(s)

Marco Scutari

References

Ide JS, Cozman FG (2002). "Random Generation of Bayesian Networks". Proceedings of the 16th Brazilian Symposium on Artificial Intelligence, 366–375.

Melancon G, Dutour I, Bousquet-Melou M (2001). "Random Generation of Directed Acyclic Graphs". Electronic Notes in Discrete Mathematics, 10:202–207.

Melancon G, Philippe F (2004). "Generating Connected Acyclic Digraphs Uniformly at Random". Information Processing Letters, 90(4):209–213.

Examples

empty.graph(LETTERS[1:8])
random.graph(LETTERS[1:8])
plot(random.graph(LETTERS[1:8], method = "ic-dag", max.in.degree = 2))
plot(random.graph(LETTERS[1:8]))
plot(random.graph(LETTERS[1:8], prob = 0.2))

[Package bnlearn version 4.5 Index]