View source: R/format-graphml.R
| to_graphml | R Documentation |
Converts a caugi graph to the GraphML XML format as a string. GraphML is widely supported by graph analysis tools and libraries.
to_graphml(x)
x |
A |
The GraphML export includes:
Node IDs and labels
Edge types stored as a custom edge_type attribute
Graph class stored as a graph-level attribute
Edge types are encoded using the caugi DSL operators (e.g., "–>", "<->"). This allows for perfect round-trip conversion back to caugi.
A caugi_graphml object containing the GraphML representation.
Other export:
caugi_deserialize(),
caugi_dot(),
caugi_export(),
caugi_graphml(),
caugi_mermaid(),
caugi_serialize(),
export-classes,
format-caugi,
format-dot,
format-graphml,
format-mermaid,
knit_print.caugi_export(),
read_caugi(),
read_graphml(),
to_dot(),
to_mermaid(),
write_caugi(),
write_dot(),
write_graphml(),
write_mermaid()
cg <- caugi(
A %-->% B + C,
B %-->% D,
C %-->% D,
class = "DAG"
)
# Get GraphML string
graphml <- to_graphml(cg)
cat(graphml@content)
# Write to file
## Not run:
write_graphml(cg, "graph.graphml")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.