First version of graph.py, to be improved.