StaticNet#
- class StaticNet(graph=None, pars=None, **kwargs)[source]#
Bases:
NetworkA network class of static partnerships converted from a networkx graph. There’s no formation of new partnerships and initialized partnerships only end when one of the partners dies. The networkx graph can be created outside Starsim if population size is known. Or the graph can be created by passing a networkx generator function to Starsim.
If “seed=True” is passed as a keyword argument or a parameter in pars, it is replaced with the built-in RNG. The parameter “n” is supplied automatically to be equal to n_agents.
- Examples::
# Generate a networkx graph and pass to Starsim import networkx as nx import starsim as ss g = nx.scale_free_graph(n=10000) ss.StaticNet(graph=g)
# Pass a networkx graph generator to Starsim ss.StaticNet(graph=nx.erdos_renyi_graph, p=0.0001, seed=True)
# Just create a default graph
Attributes
betaRelative transmission on each network edge
membersReturn sorted array of all members
nowShortcut to self.t.now()
p1The first half of a network edge (person 1)
p2The second half of a network edge (person 2)
statesReturn a flat list of all states
statesdictReturn a flat dictionary (objdict) of all states
tiGet the current module timestep
timevecShortcut to self.t.timevec
Methods