p <- 10 # Number of random variables
s <- 0.4 # Sparseness of the DAG
## Generate a random DAG
set.seed(42)
dag <- as(randomDAG(p, s), "GaussParDAG")
## Calculate observational essential graph
res.obs <- dag2essgraph(dag)
## Calculate interventional essential graph for intervention targets
## {1} and {3}
res.int <- dag2essgraph(dag, as.list(c(1, 3)))
Run the code above in your browser using DataLab