Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_neighborhood(self):
"""Create a neighborhood graph of all agents."""
agents = self.agents
shapes = [agent.shape for agent in agents]
self._neighborhood = weights.contiguity.Queen.from_iterable(shapes)
self._neighborhood.agents = agents
self._neighborhood.idx = {}
for agent, key in zip(agents, self._neighborhood.neighbors.keys()):
self._neighborhood.idx[agent] = key