graph generation tools {bnlearn}R Documentation

Generate an empty or random graph

Description

Generate an empty or random graph 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) 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 parameters 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).

Author(s)

Marco Scutari

References

J.S. Ide and F.G. Cozman. Generating Random Bayesian Networks. Proceedings on 16th Brazilian Symposium on Artificial Intelligence (SBIA 2002), Advances in Artificial Intelligence, Springer-Verlag, Berlin, p. 366-375, November, 2002.

Examples

empty.graph(LETTERS[1:8])
#
#  Randomly generated Bayesian network
#
#  model:
#    [A][B][C][D][E][F][G][H]
#  nodes:                                 8
#  arcs:                                  0
#    undirected arcs:                     0
#    directed arcs:                       0
#  average markov blanket size:           0.00
#  average neighbourhood size:            0.00
#  average branching factor:              0.00
#
#  generation algorithm:                  empty
#
random.graph(LETTERS[1:8])
# <insert the description of a random graph here>
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 1.3 Index]