ModularNetwork: A modular ER network generator

class epydemic.ModularNetwork(params=None, limit=None)

A generator of modular ER networks as described by Hebert-Dufresne and Allard [HebertDA19]. These consist of several ER networks, a “core” and several “satellites”, having different sizes and edge densities, with each satellite linked to the core by a single edge.

Parameters:
  • params (Optional[Dict[str, Any]]) – experimental parameters

  • limit (Optional[int]) – (optional) limit on number of networks that can be generated

Experimental parameters

ModularNetwork.N_core: Final[str] = 'modular.N-core'

Experimental parameter holding the size of the core network.

ModularNetwork.PHI_core: Final[str] = 'modular.phi-core'

Experimental parameter holding the edge probability of the core network.

ModularNetwork.SATELLITES: Final[str] = 'modular.satellites'

Experimental parameter holding the number of satellite networks.

ModularNetwork.N_sat: Final[str] = 'modular.N-sat'

Experimental parameter holding the size of the satellite networks.

ModularNetwork.PHI_sat: Final[str] = 'modular.phi-sat'

Experimental parameter holding the edge probability of the satellite networks.

The network will also have two attributes defined on its nodes:

ModularNetwork.ORIGIN: Final[str] = 'origin'

State variable holding a node’s network of origin (0 being the core, other indices being the satellites).

State variable that is True for nodes that are the endpoints of links from a satellite to the core.

Generator methods

ModularNetwork.topology()

Return the topology marker string.

Return type:

str

Returns:

the topology marker

ModularNetwork._generate(params)

Generate a modular ER network.

Parameters:

params (Dict[str, Any]) – the experimental parameters

Returns:

the network

Accessing the core and satellites

For networks generated by this generator, we can extract the sub-networks comprising the core and satellites. Only the edges within the sub-network will be included.

static ModularNetwork.coreSubNetwork(g)

Return the sub-network composing the core. This method will only work for networks created by this class, that have the ORIGIN property set correctly. An exception will be raised if the core can’t be identified.

Parameters:

g (Graph) – the network

Return type:

Graph

Returns:

the core sub-network

static ModularNetwork.satelliteSubNetwork(g, i)

Return the sub-network composing the i’th satellite. This method will only work for networks created by this class, that have the ORIGIN property set correctly. An exception will be raised if the core can’t be identified.

Satellite 0 is equivalent to the core, as extracted by coreSubNetwork(). Satellite numbers higher than the number of satellites created will return empty networks.

Parameters:
  • g (Graph) – the network

  • i (int) – the satellite index

Return type:

Graph

Returns:

the core sub-network