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

Description Usage Arguments Details Value Author(s) Examples

Description

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

Usage

1
2
3
4
5
6
7
8
# arc operations.
set.arc(x, from, to, check.cycles = TRUE, debug = FALSE)
drop.arc(x, from, to, debug = FALSE)
reverse.arc(x, from, to, check.cycles = TRUE, debug = FALSE)

# edge (i.e. undirected arc) operations
set.edge(x, from, to, check.cycles = 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.

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

1
2
3
4
5
6
7
8
data(learning.test)
res = gs(learning.test)

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

jtrecenti/bnlearn documentation built on May 20, 2019, 3:16 a.m.