mesa-examples
mesa-examples copied to clipboard
Add New Preferential Attachment Example
Summary
This PR introduces a new Preferential Attachment simulation example, inspired by the Barabási–Albert model of network growth. The simulation models how a network evolves over time as new nodes are added and preferentially attach to existing nodes with higher degrees, leading to the emergence of scale-free network structures.
Features
- Node Agents: Represent individual nodes in the network.
- Preferential Attachment Rule: New nodes attach to existing nodes with probability proportional to node degree.
- Data Collection: Tracks the number of nodes with degree 1 over time.
- Dynamic network topology: Dynamic graph representation of the growing network.
Implementation Details
- Uses Mesa’s
Networkgrid to embed and manage the graph. - Relies on
networkxfor graph data structure and operations. - Probabilities for attachment are derived from current node degrees.
- Includes a
DataCollectorto track key metrics like node degrees.