Watts-Strogatz Network
This behavior generates agents connected on a Watts-Strogatz network.
Published by
Shortname
@eadan/create_watts_strogatz_network.js
Description

This behavior generates agents connected on a Watts-Strogatz network.

The following variables controlling the structure of the network must be set in globals.json:

  • num_nodes: (int) number of nodes (i.e. agents) in the network.
  • avg_degree: (int) average degree of the network.
  • beta: (float) rewiring probability.

This behavior is intended to be used in conjunction with @hash/create_agents.js. A minimal init.json is:

[
  {
    "agent_id": "network_creator",
    "behaviors": [
      "@eadan/create_watts_strogatz_network.js",
      "@hash/create_agents.js",
      "@hash/remove_self.js"
    ],
    "network_template": {
      "name": "person",
      "behaviors": ["AGENT_BEHAVIOR_1.js", "AGENT_BEHAVIOR_2.js"],
      "field_a": "xyz"
    }
  }
]

The state of each agent in the network will be populated with a neighbors field containing a list of agent IDs. These IDs may be used to message an agent's neighbors. For example:

for (agentID of state.get("neighbors") {
  state.addMessage(agentID, "hello", {name: "Alice"});
}

See the SIR Infection Network model for an example use-case of this behavior.