Fixed visualization and added option to output dot code (Graphviz).