These top-level functions are included as reference implementations and starting points. They are not required — you can always write your own initial data and timestep functions.
genInitialData(model)
Generates initial data for a single node. Returns a dictionary with a random integer id between 1 and 100.
Args:
model (AgentModel) — The model instance.
Returns: dict
Example:
genTimestepData(model, nodeData)
Generates updated data for a single node by incrementing its id by 1.
Args:
model (AgentModel) — The model instance.
nodeData (dict) — The node’s current data dictionary.
Returns: dict — The same nodeData dict with id incremented.
genTimestepData is a per-node function. To use it in a simulation, wrap it in a timestep function that iterates over the graph’s nodes.
Example: