Learn R Programming

PCBN (version 0.1.1)

path_hasConvergingConnections: Checks a path for converging connections and chords.

Description

Checks a path for converging connections and chords.

Usage

path_hasConvergingConnections(DAG, path)

path_hasChords(DAG, path)

Value

path_hasConvergingConnections returns TRUE

if the path contains a converging connection.

path_hasChords returns TRUE if the path contains a chord.

Arguments

DAG

Directed Acyclic Graph.

path

character vector of nodes in the DAG forming a trail.

See Also

active_cycles which uses these two functions.

Examples

Run this code

DAG = create_empty_DAG(4)
DAG = bnlearn::set.arc(DAG, 'U1', 'U2')
DAG = bnlearn::set.arc(DAG, 'U2', 'U3')
DAG = bnlearn::set.arc(DAG, 'U3', 'U4')
path_hasConvergingConnections(DAG, c('U1', 'U2', 'U3', 'U4') ) # FALSE
path_hasChords(DAG, c('U1', 'U2', 'U3', 'U4') ) # FALSE

DAG = bnlearn::set.arc(DAG, 'U1', 'U4')
path_hasConvergingConnections(DAG, c('U1', 'U2', 'U3', 'U4') ) # FALSE
path_hasChords(DAG, c('U1', 'U2', 'U3', 'U4') ) # TRUE: has a chord

DAG = create_empty_DAG(4)
DAG = bnlearn::set.arc(DAG, 'U1', 'U2')
DAG = bnlearn::set.arc(DAG, 'U2', 'U3')
DAG = bnlearn::set.arc(DAG, 'U4', 'U3')
path_hasConvergingConnections(DAG, c('U1', 'U2', 'U3', 'U4') )
# TRUE: has a converging connection
path_hasChords(DAG, c('U1', 'U2', 'U3', 'U4') ) # FALSE

Run the code above in your browser using DataLab