graph performance

Improvements to graph performance. **Not finished**