cpdag <- cgraph(A %---% B, B %---% C, class = "CPDAG")
ancestors(cpdag, "C")
#> character(0)
possible_ancestors(cpdag, "C")
#> [1] "A" "B"
possible_ancestors(cpdag, "C", open = FALSE)
#> [1] "A" "B" "C"

Possible-ancestor/descendant node-set queries
Source: R/queries.R
Description
possible_ancestors() finds every node V that is an ancestor of node in some DAG (for a PDAG-family cg) or MAG (for a PAG cg) in the equivalence class represented by cg. possible_descendants() is the mirror notion in the other direction.
Usage
possible_ancestors(cg, node, open = getOption("CausalStructures.open", TRUE))
possible_descendants(cg, node, open = getOption("CausalStructures.open", TRUE))Arguments
cg
|
A PDAG-family (PDAG, CPDAG, MPDAG) or PAG graph created with cgraph().
|
node
|
Node name. |
open
|
If TRUE (default, from the CausalStructures.open option; see CausalStructures_options), exclude node itself from the result; if FALSE, include it.
|
Details
These are the nodes reachable from node by a possibly directed path, one on which no edge is compelled in the direction away from node (traversing an undirected edge, or a directed/circle edge oriented, or possibly orientable, toward node). Both are supersets of ancestors()/descendants(), since those only count edges compelled in the right direction.
Value
Sorted character vector of node names.
References
Perković E, Textor J, Kalisch M, Maathuis MH (2018). “Complete Graphical Characterization and Construction of Adjustment Sets in Markov Equivalence Classes of Ancestral Graphs.” Journal of Machine Learning Research, 18, 1–62.