Learn R Programming

PCBN (version 0.1.1)

find_B_sets: Find all the B-sets of a given DAG

Description

Find all the B-sets of a given DAG

Find the B sets for a given node v

Usage

find_B_sets(DAG)

find_B_sets_v(DAG, v)

Value

find_B_sets returns a list with three elements

  • B_sets list of B-sets matrices for each node;

  • has_interfering_vstrucs a boolean specifying if the graph contains interfering v-structures or not;

  • nodes_with_inter_vs a list containing nodes forming the interfering v-structures.

find_B_sets_v returns a boolean matrix with (2 + length(children))

columns and length(parents) rows. This is also true if length(parents) == 0 and length(parents) == 1.

Arguments

DAG

A bnlearn graph object

v

node at which we want to find the B-sets

Examples

Run this code
DAG = create_empty_DAG(6)
DAG = bnlearn::set.arc(DAG, 'U1', 'U5')
DAG = bnlearn::set.arc(DAG, 'U2', 'U5')
DAG = bnlearn::set.arc(DAG, 'U3', 'U5')
DAG = bnlearn::set.arc(DAG, 'U4', 'U5')

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

find_B_sets_v(DAG, v = 'U5')
B_sets = find_B_sets(DAG)
B_sets$B_sets

Run the code above in your browser using DataLab