R/frontend-dag.R

Defines functions condition_on

# TODO: merge with frontend anb

# Adds arcs from parents to node
condition_on <- function(parents, nodes, x) {
#   Replicate parents for each node 
  wparents <- rep(parents, length(nodes))
  wnodes <- rep(nodes, each = length(parents))
#   Add edges
  g <- add_edges(wparents, wnodes, x) 
  if (!skip_testing()) stopifnot(is_dag_graph(g))
  g
}
bmihaljevic/bnclassify documentation built on March 18, 2024, 8:34 a.m.