graph.py now generic