如何在线性阈值模型python中启动特定节点被感染

问题描述

我正在尝试在 Python 中使用线性阈值模型。 我有一个节点图,我想定义一个节点,它将成为第一个被感染的节点。 我看到通过使用“fraction_infected”,我可以选择将在第一次迭代中被感染的节点的一部分。我正在寻找不同的选项,我可以将特定节点定义为第一次迭代时唯一受感染的节点,而不是分数。

这是我的代码:

# linear threshold model
# Model selection
model = ep.ThresholdModel(G,seed=123)

# Model Configuration
config = mc.Configuration()
config.add_model_parameter('fraction_infected',0.1)



# Setting node parameters
threshold = 0.12
for i in G.nodes():
    config.add_node_configuration("threshold",i,threshold)

model.set_initial_status(config)

# Simulation execution
iterations = model.iteration_bunch(10)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)