def to_dotfile(self, filename):
with codecs.open(filename, "<STR_LIT:w>", "<STR_LIT:utf-8>") as file:<EOL><INDENT>for line in self:<EOL><INDENT>file.write("<STR_LIT>" % line)<EOL><DEDENT><DEDENT>
Write graph to `filename`.

>>> from anytree import Node
>>> root = Node("root")
>>> s0 = Node("sub0", parent=root)
>>> s0b = Node("sub0B", parent=s0)
>>> s0a = Node("sub0A", parent=s0)
>>> s1 = Node("sub1", parent=root)
>>> s1a = Node("sub1A", parent=s1)
>>> s1b = Node("sub1B", parent=s1)
>>> s1c = Node("sub1C", parent=s1)
>>> s1ca = Node("sub1Ca", parent=s1c)

>>> from anytree.exporter import DotExporter
>>> DotExporter(root).to_dotfile("tree.dot")

The generated file should be handed over to the `dot` tool from the
http://www.graphviz.org/ package::

    $ dot tree.dot -T png -o tree.png