dag <- cgraph(A %-->% X, X %-->% M, M %-->% Y, A %-->% Y)
minimal_separator(dag, "X", "Y") # both A and M needed
#> [1] "A" "M"
minimal_separator(dag, "X", "Y", include = "M")
#> [1] "A" "M"
minimal_separator(dag, "X", "Y", restrict = "M")
#> NULL
edge <- cgraph(A %-->% B)
minimal_separator(edge, "A", "B") # direct edge: no separator exists
#> NULL

Find a minimal separator
Source: R/identification.R
Description
Finds a minimal d-separator (DAG, PDAG classes) or m-separator (ADMG, ancestral-graph classes, PAG) between x and y. No proper subset (excluding forced include nodes) of the returned set still separates them.
Usage
minimal_separator(cg, x, y, include = character(), restrict = NULL)Arguments
cg
|
A DAG, ADMG, AG-family (AG, MAG), PDAG-family (PDAG, CPDAG, MPDAG), or PAG graph created with cgraph().
|
x, y
|
Node name, or character vector of node names (to separate the two sets). |
include
|
Character vector of nodes forced into the separator (must be a subset of restrict, if given).
|
restrict
|
Character vector of candidate nodes the separator is drawn from. NULL (default) allows every node except x and y.
|
Value
Character vector with a minimal separating set, or NULL if none exists.