Learn R Programming

PCBN (version 0.1.1)

complete_and_check_orders: Complete an order and check whether these are valid orders on parents sets

Description

Complete an order and check whether these are valid orders on parents sets

Usage

complete_and_check_orders(DAG, order_hash)

Value

NULL. This function has only side-effects, and modifies order_hash. It stops if the orders are not valid orders on the parents sets.

Arguments

DAG

the DAG

order_hash

the hashmaps of orders

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')

order_hash = r2r::hashmap()
try({complete_and_check_orders(DAG, order_hash)})
# Error because the order of the parents on "U3" should be specified.

order_hash[['U3']] = c("U1", "U2")
complete_and_check_orders(DAG, order_hash)
r2r::keys(order_hash)
# We obtain "U3" and "U4" because they both have parents

Run the code above in your browser using DataLab