Creates a random undirected and unweighted network of a certain density among agents.
This function can only be called once agents are created, so it will generally be called in the modelPostSetup
hook.
Parameters
density — float, required
A number between 0 and 1 indicating the desired graph density, i.e. the probability that any two agents will be directly connected.
kind — str, optional
A string indicating the edge kind, in order to allow for multiple networks.
Default value: 'edge'
prim — str, optional
The agent primitive among which to create the network. If
prim==None
the network will be created among agents of all primitives.Default value: None
Return Value — networkx.Graph
A NetworkX Graph object representing the created network.
charwick
Jun 04, 2020 at 22:25To create a network at the beginning of the model, use the
modelPostSetup
hook, as it runs right after agents are created.