R Under development (unstable) (2024-09-06 r87103 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(pcalg) > > p <- 10 > reps <- 10 > set.seed(21) > res <- logical(reps) > for (i in 1:reps) { + amat <- matrix(sample(c(0,1),p*p,replace=TRUE),p,p) + diag(amat) <- 0 + skelT <- amat+t(amat) + skelT[skelT != 0] <- 1 + + ## same skeleton? + my.dag <- amat2dag(amat) + skelDAG <- my.dag+t(my.dag) + res1 <- all(skelDAG == skelT) + + ## acyclic? + res2 <- ggm::isAcyclic(my.dag) + + res[i] <- res1 & res2 + } > > if(!all(res)) { + stop("Test amat2dag: Problem") + } > > proc.time() user system elapsed 0.75 0.17 0.90