Learn R Programming

PCBN (version 0.1.1)

possible_candidates: Possible candidates to be added to a partial order

Description

When given a partial order of a PCBN, one can complete it by adding one of the parents' node to the partial order. Some nodes can be added; they are then called "possible candidates".

Usage

possible_candidates(DAG, v, order_v, order_hash, B_minus_O)

possible_candidate_incoming_arc(DAG, w, v, order_v, order_hash)

possible_candidate_outgoing_arc(DAG, w, v, order_v, order_hash)

Value

possible_candidates returns a vector of possible candidates, potentially empty. Both possible_candidate_incoming_arc and possible_candidate_outgoing_arc return either a node o, or NULL if they could not find such a node.

Arguments

DAG

Directed Acyclic Graph.

order_v

partial order for node v.

order_hash

hashmap of parental orders

B_minus_O

this is the current B-set, without the elements of order_v, i.e. this is the set of elements that could be considered possible candidates.

w, v

nodes in DAG. w is assumed to be a parent of v.

Details

possible_candidate_incoming_arc returns a node o such w is a parent of o, and w can be used as an incoming arc to v by the node o. If no such o can be found, w cannot be used as a potential candidate for the order of v by incoming arc. Then, the function possible_candidate_incoming_arc returns NULL.

In the same way, possible_candidate_outgoing_arc returns a node o such o is a parent of w, and w can be used as an outgoing arc to v by the node o.

See Also

dsep_set for checking whether two sets of nodes are d-separated by another set. find_B_sets to find the B-sets.

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, 'U1', 'U4')
DAG = bnlearn::set.arc(DAG, 'U2', 'U4')
DAG = bnlearn::set.arc(DAG, 'U3', 'U4')

order_hash = r2r::hashmap()
order_hash[['U3']] = c("U1", "U2")

# Node of interest
v = "U4"

# If we start by 1, then the arc 1 -> 3 cannot be used as an incoming arc
# (it is actually an outgoing arc)
possible_candidate_incoming_arc(
  DAG = DAG, w = "U3", v = v, order_v = c("U1"), order_hash = order_hash)
possible_candidate_outgoing_arc(
  DAG = DAG, w = "U3", v = v, order_v = c("U1"), order_hash = order_hash)
possible_candidates(
  DAG = DAG, v = v, order_v = c("U1"), order_hash = order_hash, B_minus_O = "U2")


Run the code above in your browser using DataLab