'Return a dot representation suitable for using with Graphviz.
>>> dg = DependencyGraph(
...     \'John N 2\n\'
...     \'loves V 0\n\'
...     \'Mary N 2\'
>>> print(dg.to_dot())
digraph G{
edge [dir=forward]
node [shape=plaintext]
<BLANKLINE>
0 [label="0 (None)"]
0 -> 2 [label="ROOT"]
1 [label="1 (John)"]
2 [label="2 (loves)"]
2 -> 1 [label=""]
2 -> 3 [label=""]
3 [label="3 (Mary)"]'

def to_dot(self):

    s = u'digraph    G{\n'
    s += u'edge    [dir=forward]\n'
    s += u'node    [shape=plaintext]\n'
    for node in sorted(self.nodes.values(), key=(lambda v: v[u'address'])):
        s += (u'\n%s    [label="%s    (%s)"]' % (node[u'address'], node[u'address'], node[u'word']))
        for (rel, deps) in node[u'deps'].items():
            for dep in deps:
                if (rel is not None):
                    s += (u'\n%s    ->    %s    [label="%s"]' % (node[u'address'], dep, rel))
                else:
                    s += (u'\n%s    ->    %s    ' % (node[u'address'], dep))
    s += u'\n}'
    return s
