Helper class to draw a state graph into a PNG file.
It requires graphviz and pygraphviz to be installed.
PngDrawer(
self,
fontname: str | None = None,
labels: LabelsDict | None = None
)Example:
drawer = PngDrawer()
drawer.draw(state_graph, "graph.png")| Name | Type | Description |
|---|---|---|
fontname | str | None | Default: NoneThe font to use for the labels. Defaults to "arial". |
labels | LabelsDict | None | Default: NoneA dictionary of label overrides. The dictionary should have the following format: { "nodes": { "node1": "CustomLabel1", "node2": "CustomLabel2", "end": "End Node" }, "edges": { "continue": "ContinueLabel", "end": "EndLabel" } } The keys are the original labels, and the values are the new labels. |
| Name | Type |
|---|---|
| fontname | str | None |
| labels | LabelsDict | None |
Returns the label to use for a node.
Returns the label to use for an edge.
Adds a node to the graph.
Adds an edge to the graph.
Draw the given state graph into a PNG file.
Requires graphviz and pygraphviz to be installed.
Add nodes to the graph.
Add subgraphs to the graph.
Add edges to the graph.
Update the styles of the entrypoint and END nodes.