Skip to main content
A compiled graph knows its own shape, and Cognis can serialize that shape to three formats. Use this when you want a doc artifact, a debugging aid, or a quick mental check that the topology you built is the topology you wanted.

Three formats

Quick example

Source: examples/graphs/graph_dot_export.rs.

What appears in the rendering

  • Nodes — by name. Start node and end terminal are highlighted.
  • Static edges — declared via .edge(from, to).
  • Dynamic edges — inferred from Goto::node targets reachable in the topology.
  • Subgraphs — nested cluster (DOT) or subgraph block (Mermaid).
Edges that depend on state at runtime (e.g., Goto::node chosen in a node body) appear as candidate edges — the renderer can’t know which one fires until execution time.

Embedding in docs

For repo READMEs and mintlify pages, Mermaid is friction-free:
Generate the block from your test setup:
Snapshot the rendered string in tests so PRs that change the graph also update the picture.

How it works

  • Rendering walks the compiled graph’s internal topology. No state involved — purely structural.
  • Dynamic gotos can’t be statically resolved. Renderers conservatively show all reachable targets.
  • Mermaid uses flowchart TD by default — top-down. Use to_mermaid_with_direction(Direction::Lr) for left-right when you need horizontal layouts (where supported).

See also

Control flow

What you’re visualizing.

Streaming

Watch the graph execute.