NetworkExperiment
: An experiment over a network
- class epydemic.NetworkExperiment(g=None)
Bases:
Experiment
A very lightweight base class for providing a network to an experiment. The network can either be a fixed network used for each experimental run, or a network generator that will be used to generate a new instance for each run.
- Parameters:
g (
Union
[Graph
,NetworkGenerator
,None
]) – (optional) prototype network or network generator
In use
NetworkExperiment
simply adds functions to associate a network or a network
generator with a computational experiment.
- NetworkExperiment.network()
Return the network this dynamics is running over. This will return None unless we’re actually running a simulation.
- Return type:
Graph
- Returns:
the network
- NetworkExperiment.setNetworkGenerator(g)
Set the network or generator for the networks the dynamics will run over. If a network is supplied rather than a generator it will be treated as an instance of
FixedNetwork
.Note that calling this method doesn’t change the working network mid-experiment: for that, use
NetworkExperiment.setNetwork()
.- Parameters:
g (
Union
[Graph
,NetworkGenerator
]) – network or network generator
- NetworkExperiment.networkGenerator()
Return the generator used for this dynamics.
- Return type:
- Returns:
the generator
During set-up the experiment instantiates a working copy network for
use within the experiment, deleting it afterwards. If the experiment
was provided with a single “prototype” network, whis is copied each
time; if it was provided with an instance of
NetworkGenerator
, a new instance of the class of networks
defined by the generator is used.
- NetworkExperiment.setUp(params)
Set up the experiment for a run. This creates a working copy of the network (class) underlying the experiment.
- Parameters:
params (
Dict
[str
,Any
]) – the experimental parameters