use `iterkeys` instead of `keys` -- keys performs a full copy of the datastructure which gets very expensive as your graph grows.