Converts a caugi graph to the Graphviz DOT format as a string. The DOT format can be used with Graphviz tools for visualization and analysis.
Details
The function handles different edge types:
Directed edges (
-->) use->in DOTUndirected edges (
---) use--in DOT (or->withdir=nonein digraphs)Bidirected edges (
<->) use->with[dir=both]attributePartial edges (
o->) use->with[arrowtail=odot, dir=both]attribute
See also
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_graphml(),
to_mermaid(),
write_caugi(),
write_dot(),
write_graphml(),
write_mermaid()
Examples
cg <- caugi(
A %-->% B + C,
B %-->% D,
C %-->% D,
class = "DAG"
)
# Get DOT string
dot <- to_dot(cg)
dot@content
#> [1] "digraph {\n\n // Nodes\n A;\n B;\n C;\n D;\n\n // Edges\n A -> B;\n A -> C;\n B -> D;\n C -> D;\n}"
# With custom attributes
dot <- to_dot(
cg,
graph_attrs = list(rankdir = "LR"),
node_attrs = list(shape = "box")
)