Standard network generators

Below is a list of standard network generators built-in to epydemic. These are intended to cover the common use cases, and in particular the classes of network that are used commonly in experimental network science.

Note

See Building a network generator for a tutorial on how to add new generators.

FixedNetwork: A single example network

class epydemic.FixedNetwork(g, limit=None)

A network generator that always returns a copy of the same network.

Parameters:
  • g (Graph) – the prototype network

  • limit (Optional[int]) – (optional) maximum number of identical instances to generate

FixedNetwork.topology()

Return the topoology flag for this generator.

Return type:

str

Returns:

the topology marker (“Arbitrary”)

ERNetwork: Random networks with Poisson-distributed node degrees

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

Generate Erdos-Renyi (ER) networks from a given order (N) and one of an edge occupation probability (PHI) or a mean degree (KMEAN). These parameters are taken from the experimental parameters.

An ER network has nodes with Poisson-distributed independent degrees. The construction process can be thought of as taking a set of \(N\) nodes and then adding an edge between every pair with independent probability \(\phi\). This process gives a discrete normal (Poisson) distribution of the node degrees with mean degree \(\langle k \rangle = N \phi\). The node degrees will be uncorrelated.

The actual construction of ER networks uses the networkx.fast_gnp_random_graph() function.

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

  • limit (Optional[int]) – (optional) meximum number of instances to generate

ERNetwork.N: Final[str] = 'N'

Experimental parameter for the size (order) of the network.

ERNetwork.PHI: Final[str] = 'phi'

Experimental parameter for the occupation probability of edges.

ERNetwork.KMEAN: Final[str] = 'kmean'

Experimental parameter for the mean degree of the network.

ERNetwork.topology()

Return the topoology flag for this generator.

Return type:

str

Returns:

the topology marker (“ER”)

BANetwork: Random networks with powerlaw-distributed node degrees

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

Generate Barabasi-Albert (BA) networks from a given order (N) and rate of attachment (M) taken from the experimental parameters.

A BA network has node degrees distributed according to a powerlaw distribution. The construction process can be thought of as taking an initial set of \(M\) nodes and then adding additional nodes one at a time, adding adges between the new node and \(M\) other nodes chosen at random. This continues until the network has \(N\) nodes. This process favours attachment to nodes that are in the network early, leading to “hubs” with very high degree. The node degrees will be uncorrelated.

The actual construction of BA networks uses the networkx.barabasi_albert_graph() function.

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

  • limit (Optional[int]) – (optional) meximum number of instances to generate

BANetwork.N: Final[str] = 'N'

Experimental parameter for the size (order) of the network.

BANetwork.M: Final[str] = 'MperNode'

Experimental parameter for the number of edges added per node.

BANetwork.topology()

Return the topoology flag for this generator.

Return type:

str

Returns:

the topology marker (“BA”)

PLCNetwork: Random networks with powerlaw-distributed node degrees and an exponential cutoff

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

A generator for networks with a powerlaw-with-cutoff degree distribution.

PLC networks are commonly used to represent the basic structure of human contact networks, where we want to cutoff the degree to stop it becoming “too high” to be credible: Newman [New02] (and other works) use this topology extensively. It is characterised by two parameters, the exponent of the power law and the cutoff maximum degree after which the probability of finding nodes with larger degrees falls off exponentially.

Internally we use the configuration model [MR96] to create the network.

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

  • limit (Optional[int]) – (optional) maximum number of independent networks to generate

Note

Using this class of networks for human populations is discussed in Modelling human contact networks.

PLCNetwork.N: Final[str] = 'N'

Experimental parameter for the order of the network.

PLCNetwork.EXPONENT: Final[str] = 'exponent'

Experimental parameter for the exponent of the distribution.

PLCNetwork.CUTOFF: Final[str] = 'cutoff'

Experimental parameter for the cutoff of the distribution.

PLCNetwork.topology()

Return the topoology flag for this generator.

Return type:

str

Returns:

the topology mmarker (“PLC”)