pydot allows to easily create both directed and non directed graphs from Python. Currently all attributes implemented in the Dot language are supported (up to Graphviz 2.16).