Install Emergent
Build your first simulation
A simulation in Emergent has four steps:- Create an
AgentModel - Define an initial data function — what state does each agent start with?
- Define a timestep function — how does each agent update?
- Run the simulation
Step 1 — Create the model
Step 2 — Define the initial data function
Each node receives the return value of this function as its starting data. The function receives the model as its only argument.Step 3 — Define the timestep function
This function is called once per timestep and should mutate node data on the graph. Usemodel.get_graph() to access the underlying NetworkX graph.
Step 4 — Run the simulation
Option A — Run to convergence Emergent can automatically stop when a tracked variable stabilizes within a given standard deviation threshold:Complete example
Next steps
AgentModel concepts
Deep dive into parameters, graphs, and convergence.
Graph structures
Choose the right graph topology for your simulation.