Skip to content

Commit

Permalink
Update NetworkGrid.__init__ docstring
Browse files Browse the repository at this point in the history
Specify that NetworkGrid requires a Networkx 
graph instance.
  • Loading branch information
Tortar authored and rht committed Nov 7, 2022
1 parent 45171f3 commit a783971
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,11 @@ class NetworkGrid:
"""Network Grid where each node contains zero or more agents."""

def __init__(self, G: Any) -> None:
"""Create a new network.
Args:
G: a NetworkX graph instance.
"""
self.G = G
for node_id in self.G.nodes:
G.nodes[node_id]["agent"] = self.default_val()
Expand Down

0 comments on commit a783971

Please sign in to comment.