aryagraph.io.dot.to_dot#
- aryagraph.io.dot.to_dot(g: Graph, *, name: str | None = None, node_attrs: bool | Iterable[str] = True, edge_attrs: bool | Iterable[str] = True, rankdir: str | None = None) str[source]#
DOT text for g.
- Parameters:
name – Graph ID (defaults to
g.name).node_attrs, edge_attrs – Write all attributes, none, or the named ones. Numbers are written as DOT numerals, booleans as
true/false, sequences of numbers as"x,y"(Graphviz’s point syntax) and other containers as JSON.rankdir – Graphviz layout direction (
"TB","LR", …), written as a graph attribute.
Notes
Nodes with a
clusterattribute are grouped intosubgraph cluster_…blocks (with the attributes ing.attrs["clusters"]), which is exactly whatfrom_dot()produces, so clusters round-trip. Scalar graph attributes are written in agraph [...]statement.Examples
>>> print(to_dot(DiGraph([("a", "b b")])), end="") digraph { a; "b b"; a -> "b b"; }