graph.py: clean up constructors and factor out common init from file in _GraphBase