dot: Add to_dot function to the Diagram interface

`to_dot` returns a string that contains a representation of the diagram in the DOT graph description language. Use Graphviz or a similar program to render and view it.