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.Documentation Index
Fetch the complete documentation index at: https://cognis.vasanth.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Three formats
| Format | Use for |
|---|---|
to_dot() | Pipe through dot -Tsvg > graph.svg or paste into any GraphViz viewer. Best fidelity. |
to_mermaid() | Drop into Markdown — GitHub, Notion, mintlify all render it natively. |
to_ascii() | Quick terminal check, log artifact, no external tooling. |
Quick example
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::nodetargets reachable in the topology. - Subgraphs — nested cluster (DOT) or subgraph block (Mermaid).
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: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 TDby default — top-down. Useto_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.