Learn R Programming

caugi (version 1.0.0)

to_dot: 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())

Value

A caugi_dot object containing the DOT representation.

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 [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

Run this code
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")
)

Run the code above in your browser using DataLab