|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
The current simulation create a 2-d grid network. We want to be able to use other types of
networks, 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,应该怎么写呢 |
|