is_simple: Is the 'caugi' graph simple?

View source: R/queries.R

is_simpleR Documentation

Is the caugi graph simple?

Description

Checks if the given caugi graph is simple (no self-loops and no parallel edges).

Usage

is_simple(cg, force_check = FALSE)

Arguments

cg

A caugi object.

force_check

Logical; if TRUE, force a check against the compiled graph representation. If FALSE (default), return the declared simple property.

Value

A logical value indicating whether the graph is simple.

See Also

Other queries: ancestors(), anteriors(), children(), components(), descendants(), districts(), edge_types(), edges(), exogenous(), is_acyclic(), is_admg(), is_ag(), is_caugi(), is_cpdag(), is_dag(), is_empty_caugi(), is_mag(), is_mpdag(), is_pdag(), is_ug(), m_separated(), markov_blanket(), neighbors(), nodes(), parents(), posteriors(), same_nodes(), spouses(), subgraph(), topological_sort()

Examples

cg_simple <- caugi(
  A %-->% B,
  class = "DAG"
)
is_simple(cg_simple) # TRUE

cg_nonsimple <- caugi(
  A %-->% B,
  A %<->% B,
  class = "UNKNOWN",
  simple = FALSE
)
is_simple(cg_nonsimple) # FALSE


caugi documentation built on Oct. 28, 2026, 1:07 a.m.