UnflattenΒΆ
To prepocess the DOT source of a Graph or Digraph with
the unflatten preprocessor
(manpage, PDF),
use the unflatten() method.
>>> import graphviz
>>> w = graphviz.Digraph('wide')
>>> w.edges(('0', str(i)) for i in range(1, 10))
>>> doctest_mark_exe()
>>> w.view()
Hint
unflatten() improves the aspect ratio of graphs
with many leaves or disconnected nodes.
>>> u = w.unflatten(stagger=3)
>>> doctest_mark_exe()
>>> u.view()
The method returns a Source object
that you can render(), view(), etc.
with the same basic API as Graph or Digraph objects
(minus modification, see details below).
>>> u = w.unflatten(stagger=2)
>>> u
<graphviz.sources.Source object at 0x...>
>>> doctest_mark_exe()
>>> u.view()