Is the caugi acyclic?
is_acyclic.RdChecks if the given caugi graph is acyclic.
Details
Logically, it should not be possible to have a graph class of "DAG" or "PDAG" that has cycles, but in case the user modified the graph after creation in some unforeseen way that could have introduced cycles, this function allows to force a check of acyclicity, if needed.
See also
Other queries:
ancestors(),
children(),
descendants(),
edge_types(),
edges(),
exogenous(),
is_caugi(),
is_cpdag(),
is_dag(),
is_empty_caugi(),
is_pdag(),
markov_blanket(),
neighbors(),
nodes(),
parents(),
same_nodes(),
subgraph()
Examples
cg_acyclic <- caugi_graph(
A %-->% B,
B %-->% C,
class = "DAG"
)
is_acyclic(cg_acyclic) # TRUE
#> [1] TRUE
cg_cyclic <- caugi_graph(
A %-->% B,
B %-->% C,
C %-->% A,
class = "UNKNOWN"
)
is_acyclic(cg_cyclic) # FALSE
#> [1] FALSE