Remove dgraph.py, rewrite graph.py