Learn R Programming

PCBN (version 0.1.1)

B_sets_make_unique: Compress a given collection of B-sets

Description

Compress a given collection of B-sets

Usage

B_sets_make_unique(B_sets)

Value

a `data.frame` made of the unique rows of `B_sets`. An additional column `nodes` is added at the start. It contains all the children of v corresponding to this B-set.

Arguments

B_sets

a boolean matrix with (2 + length(children)) columns and length(parents) rows. They are assumed to be sorted in increasing order of row sums, i.e. by increasing order of set cardinality. Typically, this will be the output of find_B_sets_v for some node v.

Examples

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

B_sets_make_unique(B_sets)

Run the code above in your browser using DataLab