From 4156489924ba40ea47d09b03e5cd5c94bf3ab627 Mon Sep 17 00:00:00 2001 From: Abhijit1102 Date: Wed, 28 Feb 2024 23:54:03 +0530 Subject: [PATCH] Make connections in experiment cell space named #2060 --- mesa/experimental/cell_space/cell.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesa/experimental/cell_space/cell.py b/mesa/experimental/cell_space/cell.py index 55264f68daa..85d24e749a0 100644 --- a/mesa/experimental/cell_space/cell.py +++ b/mesa/experimental/cell_space/cell.py @@ -24,7 +24,7 @@ class Cell: __slots__ = [ "coordinate", - "_connections", + "connections", "agents", "capacity", "properties", @@ -56,7 +56,7 @@ def __init__( """ super().__init__() self.coordinate = coordinate - self._connections: list[Cell] = [] # TODO: change to CellCollection? + self.connections: dict[str, Cell] = {} # TODO: change to CellCollection? self.agents = [] # TODO:: change to AgentSet or weakrefs? (neither is very performant, ) self.capacity = capacity self.properties: dict[str, object] = {} @@ -69,7 +69,7 @@ def connect(self, other: Cell) -> None: other (Cell): other cell to connect to """ - self._connections.append(other) + self.connections.append(other) def disconnect(self, other: Cell) -> None: """Disconnects this cell from another cell. @@ -78,7 +78,7 @@ def disconnect(self, other: Cell) -> None: other (Cell): other cell to remove from connections """ - self._connections.remove(other) + self.connections.remove(other) def add_agent(self, agent: CellAgent) -> None: """Adds an agent to the cell.