Change Graph.neighbors to a generator.