Converts a caugi graph to a JSON string in the native caugi format.
This is a lower-level function; consider using write_caugi() for
writing to files.
See also
Other export:
caugi_deserialize(),
caugi_dot(),
caugi_export(),
caugi_graphml(),
caugi_mermaid(),
export-classes,
format-caugi,
format-dot,
format-graphml,
format-mermaid,
knit_print.caugi_export,
read_caugi(),
read_graphml(),
to_dot(),
to_graphml(),
to_mermaid(),
write_caugi(),
write_dot(),
write_graphml(),
write_mermaid()
Examples
cg <- caugi(A %-->% B, class = "DAG")
json <- caugi_serialize(cg)
cat(json)
#> {
#> "$schema": "https://caugi.org/schemas/caugi-v1.schema.json",
#> "format": "caugi",
#> "version": "1.0.0",
#> "graph": {
#> "class": "DAG",
#> "nodes": [
#> "A",
#> "B"
#> ],
#> "edges": [
#> {
#> "from": "A",
#> "to": "B",
#> "edge": "-->"
#> }
#> ]
#> }
#> }