Reference 〉Function

Helipad.createNetwork( float density, str kind = 'edge', str prim = None )

Creates a random undirected and unweighted network of a certain density among agents.

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.

Notes and Examples

  1. charwick

    Jun 04, 2020 at 22:25

    To create a network at the beginning of the model, use the modelPostSetup hook, as it runs right after agents are created.

    def modelPostSetup(model):
    	n = model.createNetwork(0.2)
    heli.addHook('modelPostSetup', modelPostSetup)
  2. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History