Learn R Programming

PCBN (version 0.1.1)

is_order_abiding_Bsets: Check whether a certain order abides by the B-sets

Description

Check whether a certain order abides by the B-sets

Usage

is_order_abiding_Bsets(DAG, order_hash)

is_order_abiding_Bsets_v(B_sets, orderParents)

Value

It returns `TRUE` if the order abides by the B-sets, and `FALSE` else.

Arguments

DAG

the considered DAG

order_hash

the hashmaps of parents ordering

B_sets

matrix of B-sets, assumed to be increasing. This can be the output of find_B_sets_v or of B_sets_make_unique.

orderParents

a vector of characters, interpreted as the ordered parents

Examples

Run this code

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

order_hash = r2r::hashmap()
order_hash[['U3']] = c("U1", "U2")
order_hash[['U4']] = c("U1", "U3")
is_order_abiding_Bsets(DAG, order_hash)
order_hash[['U3']] = c("U2", "U1")
is_order_abiding_Bsets(DAG, order_hash)

Run the code above in your browser using DataLab