cg <- caugi(
A %-->% B + C,
B %-->% D,
C %-->% D,
class = "DAG"
)
# Write to file
tmp <- tempfile(fileext = ".caugi.json")
write_caugi(cg, tmp, comment = "Example DAG")
# Read back
cg2 <- read_caugi(tmp)
identical(edges(cg), edges(cg2))
# Clean up
unlink(tmp)
Run the code above in your browser using DataLab