to_dot: Export caugi Graph to DOT Format

View source: R/format-dot.R

to_dotR Documentation

Export caugi Graph to DOT Format

Description

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.

Usage

to_dot(x, graph_attrs = list(), node_attrs = list(), edge_attrs = list())

Arguments

x

A caugi object.

graph_attrs

Named list of graph attributes (e.g., list(rankdir = "LR")).

node_attrs

Named list of default node attributes.

edge_attrs

Named list of default edge attributes.

Details

The function handles different edge types:

  • Directed edges (⁠-->⁠) use ⁠->⁠ in DOT

  • Undirected edges (⁠---⁠) use ⁠--⁠ in DOT (or ⁠->⁠ with dir=none in digraphs)

  • Bidirected edges (⁠<->⁠) use ⁠->⁠ with ⁠[dir=both]⁠ attribute

  • Partial edges (⁠o->⁠) use ⁠->⁠ with ⁠[dir=both, arrowtail=odot]⁠ attribute

  • Partial edges (--o) use ⁠->⁠ with ⁠[arrowhead=odot]⁠ attribute

  • Partial edges (o-o) use ⁠->⁠ with ⁠[dir=both, arrowtail=odot, arrowhead=odot]⁠ attribute

Value

A caugi_dot object containing the DOT representation.

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

# With custom attributes
dot <- to_dot(
  cg,
  graph_attrs = list(rankdir = "LR"),
  node_attrs = list(shape = "box")
)


caugi documentation built on Oct. 28, 2026, 1:07 a.m.