projectmesa/mesa

Inconsistency in get_neighbors Method Parameters for NetworkGrid in Mesa 2.2.4

chingisdev opened this issue · 1 comments

Describe the bug
The get_neighbors method for NetworkGrid as outlined in the Mesa documentation suggests that this method accepts a radius parameter. However, upon inspection and usage in Mesa version 2.2.4, it appears that the radius parameter is not implemented in the get_neighbors method.

Expected behavior
To ensure consistency with the documentation and to facilitate depth-wise traversal or analysis within the graph, it's expected that the get_neighbors method should accept a radius parameter as described in the documentation. This would allow for more flexible and powerful network analyses directly within Mesa models.

To Reproduce

  1. Install Mesa version 2.2.4.
  2. Create a simple model that includes a NetworkGrid.
  3. Attempt to call the get_neighbors method on the grid instance, passing a node ID and a radius value, typically within a model's step method.
  4. Observe that an unexpected argument error is raised due to the absence of the radius parameter.

Example Code:

network_grid = NetworkGrid(some_networkx_graph)
node_id = random.choice(list(some_networkx_graph.nodes))
neighbors = network_grid.get_neighbors(node_id, radius=2)

Additional Context:
Adjusting method signatures to match the documentation can greatly enhance usability and developer experience, especially for those relying on network-based analyses in their agent-based models.

Update: Upon preparing to contribute a fix, I cloned the repository and found that the issue has already been addressed in the codebase. However, these updates are not yet reflected in the latest release version.