pydot is an open source program that allows you to easily create both directed and non directed graphs from Python.
The program supports all attributes implemented in the Dot language(up to Graphviz 2.26.3). You can also inline the output into interactive scientific environments.