Learn R Programming

PCBN (version 0.1.1)

DAG_to_restrictedDAG: Turns a general graph into a restricted graph.

Description

Turns a general graph into a restricted graph.

Usage

DAG_to_restrictedDAG(DAG)

fix_active_cycles(DAG, active_cycles_list = NULL)

fix_interfering_vstructs(DAG, all_B_sets = NULL)

Value

Restricted DAG.

Arguments

DAG

a directed acyclic graph object, of class bn.

active_cycles_list, all_B_sets

respective outputs of the functions active_cycles and find_B_sets. If they are NULL, the respective function is called to compute them.

See Also

is_restrictedDAG to check whether a given DAG is restricted.

Examples

Run this code
# DAG with an active cycle at node 5
DAG = create_empty_DAG(5)
DAG = bnlearn::set.arc(DAG, 'U1', 'U3')
DAG = bnlearn::set.arc(DAG, 'U1', 'U2')
DAG = bnlearn::set.arc(DAG, 'U2', 'U4')
DAG = bnlearn::set.arc(DAG, 'U3', 'U5')
DAG = bnlearn::set.arc(DAG, 'U4', 'U5')

# Fixed graph has extra arcs 1 -> 5, 2 -> 5
fixed_DAG = DAG_to_restrictedDAG(DAG)


# DAG with an interfering v-structures node 3
DAG = create_empty_DAG(5)
DAG = bnlearn::set.arc(DAG, 'U1', 'U3')
DAG = bnlearn::set.arc(DAG, 'U1', 'U4')
DAG = bnlearn::set.arc(DAG, 'U2', 'U3')
DAG = bnlearn::set.arc(DAG, 'U2', 'U5')
DAG = bnlearn::set.arc(DAG, 'U3', 'U4')
DAG = bnlearn::set.arc(DAG, 'U3', 'U5')

# Fixed graph has extra arc 1 -> 5
fixed_DAG = DAG_to_restrictedDAG(DAG)

Run the code above in your browser using DataLab