andrey.viz.to_graphviz#
- andrey.viz.to_graphviz(structure, options=None)[source]#
Return
structureas a Graphviz graph.- Parameters:
structure (
GraphStructure) – Any kind. Nodekis named"k"and carries its label aslabel; each edge keeps its endpoint marks as Graphviz arrow shapes:normalfor an arrowhead,odotfor a circle, none for a tail.options (
Mapping[str,object] |None) – Graphviz graph attributes, such as{"rankdir": "TB", "nodesep": 0.5}. Causes run left to right (rankdir="LR") unlessoptionssays otherwise.
- Returns:
A directed graph. A directed edge runs from tail to arrowhead; an undirected edge has
dir="none"; any other edge hasdir="both", witharrowheadandarrowtailset from its marks; adigraph2-cycle becomes two directed edges. Render or lay it out with pygraphviz, or pass it to any Graphviz tool throughto_string().- Return type:
AGraph- Raises:
ImportError – If pygraphviz is not installed.