Skip to contents

Reads a caugi graph from a file in the native caugi JSON format.

Usage

read_caugi(path, lazy = FALSE)

Arguments

path

Character string specifying the file path.

lazy

Logical; if FALSE (default), the graph is built immediately. If TRUE, graph building is deferred until needed.

Value

A caugi object.

Details

The function validates the file format and version, ensuring compatibility with the current version of the caugi package.

Examples

cg <- caugi(
  A %-->% B + C,
  class = "DAG"
)

# Write and read
tmp <- tempfile(fileext = ".caugi.json")
write_caugi(cg, tmp)
cg2 <- read_caugi(tmp)

# Clean up
unlink(tmp)