Checks if the given caugi graph is an
Ancestral Graph (AG).
An AG contains directed (-->), bidirected (<->), and undirected (---)
edges, and must satisfy ancestral graph constraints (no directed cycles,
anterior constraint, and undirected constraint).
Usage
is_ag(cg, force_check = FALSE)
Value
A logical value indicating whether the graph is an AG.
Arguments
cg
A caugi object.
force_check
Logical; if TRUE, the function will test if the graph is
an AG, if FALSE (default), it will look at the graph class and match
it, if possible.
cg_ag <- caugi(
A %-->% B,
C %<->% D,
E %---% F,
class = "AG")
is_ag(cg_ag) # TRUE
cg_ug <- caugi(
A %---% B,
class = "UG")
is_ag(cg_ug) # TRUE (UGs are valid AGs)