teff.graph.render¶
teff.graph.render
¶
Graph serialization: Mermaid diagrams and YAML topology.
Functions:
| Name | Description |
|---|---|
to_mermaid |
Render graph as a Mermaid flowchart diagram. |
to_mermaid
¶
to_mermaid(graph, show_conditions=True)
Render graph as a Mermaid flowchart diagram.
Produces a flowchart TD definition: every node becomes a box
labelled node_id[node.type] and every edge an arrow. The entry
point is filled blue, __error__ edges are dashed and red, and
conditional edges carry their condition as an edge label (when
show_conditions is true).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
The graph to render (exposes |
required | |
show_conditions
|
bool
|
Annotate conditional edges with their condition. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The Mermaid diagram as a string (no code fence). |
Source code in teff/graph/render.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |