Writes an edaphos_causal_kg to an .rds file. The KG is
serialised through its tidy edge list plus metadata (version,
timestamp, R and package versions) rather than through the raw
igraph object, so the file is:
Details
Portable across igraph versions (the C-level pointer layout that
saveRDS(igraph_object)would capture is not written).Deterministic (no hash-randomised attributes), so two saves of the same KG produce byte-identical files.
Small — only the edge list and node names are written, not igraph's internal indices.
Load with causal_kg_load().
See also
causal_kg_load(), causal_kg_to_turtle() for the
human-readable RDF variant.
Examples
# \donttest{
kg <- causal_kg_new()
kg <- causal_kg_add_edge(kg, "precipitation", "soc",
source = "Jenny 1941",
confidence = 0.9)
f <- tempfile(fileext = ".rds")
causal_kg_save(kg, f)
kg2 <- causal_kg_load(f)
identical(causal_kg_edges(kg), causal_kg_edges(kg2))
#> [1] TRUE
# }
