Replaced Graph with generic supertype where possible