把network做成parameter
The current simulation create a 2-d grid network. We want to be able to use other types ofnetworks, and we want to pass these networks as parameters. We also want to pass the
number of nodes as a parameter to the init() function, and we want to pass another
parameter (call it netParam). This is a network specific parameter. For Erdos-Renyi, it is
the probability of connection p, for Barabasi-Albeter it is the number of edges a new node
has m. The init() function line should look something like:
def init(network, nb_agents, netParam, probInfectionInit):
You need to make necessary changes in the code inside init() function. Test your
simulation again (passing a ER network with p=0.1). For the sake of this testing alone,
you can add default values for your parameters in init() like:
def init(network =nx.erdos_renyi_graph, nb_agents, netParam=.1, probInfectionInit):
大意就是网络里的点当作一个parameter,应该怎么写呢 英文不好,能翻译一下?
页:
[1]