Skip to contents

Returns the number of DAGs in the Markov equivalence class of a PDAG without materializing each one. Useful for sizing an enumeration before calling enumerate_dags().

Usage

count_dags(cg)

Arguments

cg

A caugi object of class "PDAG" or "MPDAG".

Value

A single numeric value, the cardinality of the MEC. Counts above 2^53 lose integer precision; in practice no realistic PDAG yields a MEC anywhere near that size.

References

Chickering, D. M. (2002). "Learning Equivalence Classes of Bayesian-Network Structures". Journal of Machine Learning Research, 2:445–498.

Examples

pdag <- caugi(
  A %---% B,
  B %---% C,
  class = "PDAG"
)
count_dags(pdag) # 3
#> [1] 3