arc operations {bnlearn}R Documentation

Drop, add or set the direction of an arc or an edge

Description

Drop, add or set the direction of a directed or undirected arc (also known as edge).

Usage

# arc operations.
set.arc(x, from, to, check.cycles = TRUE, check.illegal = TRUE, debug = FALSE)
drop.arc(x, from, to, debug = FALSE)
reverse.arc(x, from, to, check.cycles = TRUE, check.illegal = TRUE, debug = FALSE)

# edge (i.e. undirected arc) operations
set.edge(x, from, to, check.cycles = TRUE, check.illegal = TRUE, debug = FALSE)
drop.edge(x, from, to, debug = FALSE)

Arguments

x

an object of class bn.

from

a character string, the label of a node.

to

a character string, the label of another node.

check.cycles

a boolean value. If TRUE the graph is tested for acyclicity; otherwise the graph is returned anyway.

check.illegal

a boolean value. If TRUE arcs that break the parametric assumptions of x, such as those from continuous to discrete nodes in conditional Gaussian networks, cause an error.

debug

a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is completely silent.

Details

The set.arc() function operates in the following way:

The drop.arc() function operates in the following way:

The reverse.arc() function operates in the following way:

The set.edge() function operates in the following way:

The drop.edge() function operates in the following way:

Value

All functions return invisibly an updated copy of x.

Author(s)

Marco Scutari

Examples

dag = cpdag(model2network("[A][C][F][B|A][D|A:C][E|B:F]"))
dag

## use debug = TRUE to get more information.
updated = set.arc(dag, "A", "B")
updated
updated = drop.arc(dag, "A", "B")
updated
updated = drop.edge(dag, "A", "B")
updated
updated = reverse.arc(dag, "A", "D")
updated

[Package bnlearn version 4.9.3 Index]