Convert a DAG to a Completed Partially Directed Acyclic Graph (CPDAG).
Usage
dag2cpdag(dag)
Arguments
dag
DAG (graph object)
Value
An adjacency matrix containing the CPDAG.
Details
This function converts a DAG (graph object) to its corresponding
(unique) CPDAG (graph object). We use the algorithm used by
Chickering (see References).
References
D.M. Chickering, Learning Equivalence Classes of Bayesian-Network
Structures, Journal of Machine Learning Research 2 (2002), 445-398
p <- 10 # number of random variabless <- 0.4 # sparsness of the graph## generate random dataset.seed(42)
g <- randomDAG(p,s) # generate a random DAG
res <- dag2cpdag(g)