Learn R Programming

PCBN (version 0.1.1)

is_restrictedDAG: Does a DAG satisfy the restrictions of no active cycle and no interfering v-structures

Description

This functions checks whether the DAG is restricted, i.e. whether it has no active cycles nor any interfering v-structures.

Usage

is_restrictedDAG(DAG, verbose = 2, check_both = TRUE)

Value

TRUE if the PCBN satisfies both restrictions. FALSE if at least one of the restrictions is not satisfies.

Arguments

DAG

the DAG object

verbose

if verbose is 2, details are printed. If verbose is 1, details are printed only if an active cycle or an interfering v-structure is found. If verbose is 0 the function does not print anything and only returns TRUE or FALSE.

check_both

if TRUE, both v-structures and active cycles are checked anyway. If FALSE, the function stops early if it already found any v-structures.

See Also

DAG_to_restrictedDAG for one way of making the DAG to be restricted if it is not the case.

active_cycles to find all active cycles. has_interfering_vstrucs to check only for interfering v-structures.

Examples

Run this code

DAG = create_empty_DAG(4)
DAG = bnlearn::set.arc(DAG, 'U1', 'U2')
DAG = bnlearn::set.arc(DAG, 'U1', 'U3')
DAG = bnlearn::set.arc(DAG, 'U2', 'U4')
DAG = bnlearn::set.arc(DAG, 'U3', 'U4')

is_restrictedDAG(DAG)  # 1 active cycle

Run the code above in your browser using DataLab