StaticNet#
- class StaticNet(graph=None, pars=None, **kwargs)[source]#
Bases:
Network
A 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
beta
Relative transmission on each network edge
members
Return sorted array of all members
now
Shortcut to self.t.now()
p1
The first half of a network edge (person 1)
p2
The second half of a network edge (person 2)
states
Return a flat list of all states
statesdict
Return a flat dictionary (objdict) of all states
ti
Get the current module timestep
timevec
Shortcut to self.t.timevec
Methods