code games. learn Python.
third party python library for graphs
pydot is an interface to Graphviz and can parse and dump into the DOT language used by GraphViz