refactoring: split graph.py into one major class per file