is_direction_possible: is_direction_possible

Description Usage Arguments Examples

Description

This function checks whether a certain direction of the edges is possible. It first check whether the direction alone causes any more v-structures. Then, it applies the MEC-Rules of the pcalg algorithm, and checks whether this causes any more v-structures. If both don't cause more v-structures, the direction is allowed.

Usage

1
is_direction_possible(pdag, v_structures)

Arguments

pdag
v_structures

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (pdag, v_structures)
{
    possible_direction <- TRUE
    pdag_v <- number_v_nodes(pdag)
    if (v_structures != pdag_v) {
        possible_direction <- FALSE
    }
    if (possible_direction) {
        pdag <- apply_mec_rules(pdag)
        pdag_v <- number_v_nodes(pdag)
        if (v_structures != pdag_v) {
            possible_direction <- FALSE
        }
    }
    return(possible_direction)
  }

gekepals/pcabs documentation built on June 15, 2019, 12:03 a.m.