Learn R Programming

PCBN (version 0.1.1)

has_interfering_vstrucs: Checks if graph has interfering v-structures

Description

Checks if graph has interfering v-structures

Usage

has_interfering_vstrucs(DAG, verbose = 0)

Value

TRUE if graph contains (at least) an interfering v-structure, and FALSE if it does not contain any interfering v-structure.

Arguments

DAG

Directed Acyclic Graph

verbose

if verbose is 0, do not print anything. If verbose is positive, print the name of the first node at which the interfering v-structure is found.

Examples

Run this code

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

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

# There is one interfering v-structure
has_interfering_vstrucs(DAG, verbose = 1)

DAG = bnlearn::set.arc(DAG, 'U1', 'U5')
# Now no interfering v-structure
has_interfering_vstrucs(DAG)

Run the code above in your browser using DataLab