需要这篇论文的复现。
论文名称:Dynamical Interplay between Awareness and Epidemic Spreading in Multiplex Networks
论文内容:在多路网络中构建了uau-sis模型,运用mmca计算出传播阈值,mc模拟计算出传播阈值
论文doi:https://doi.org/10.1103/PhysRevLett.111.128701
sic-hub网站上的论文:https://sci-hub.wf/10.1103/physrevlett.111.128701
要求:必须python或matlab,可以是这篇论文或在这篇论文的基础上改进的论文
网上找找资源,实现上比较复杂。
考虑时变遗忘因素的双层网络传播模型建立方法
可以参考下
https://www.xjishu.com/zhuanli/05/202111532649.html
这个不简单呐,最好能联系上作者
git找找有没有类似的资源,从零实现,比较难
给作者发个email,夸赞下他的文章写的很好,很仰慕他,能不能把实验的代码发给你学习下。一般都会给你的。不然不是你这个专业的,看懂这个论文很难的。
import numpy as np
import networkx as nx
def uau_sis_simulation(network, p, q, initial_infected, timesteps):
num_nodes = network.number_of_nodes()
states = np.zeros(num_nodes, dtype=int)
infected_count = len(initial_infected)
states[initial_infected] = 1
for t in range(timesteps):
new_states = states.copy()
for node in network.nodes():
if states[node] == 0: # Susceptible node
neighbors = list(network.neighbors(node))
infected_neighbors = sum(states[neighbors])
if np.random.rand() < p * infected_neighbors:
new_states[node] = 1 # Node becomes infected
else: # Infected node
if np.random.rand() < q:
new_states[node] = 0 # Node recovers
infected_count -= 1
states = new_states.copy()
# Stop simulation if no more infected nodes
if infected_count == 0:
break
return states
def calculate_threshold(network, p_range, q, initial_infected, timesteps, num_simulations):
threshold_results = []
for p in p_range:
total_final_infected = 0
for _ in range(num_simulations):
final_states = uau_sis_simulation(network, p, q, initial_infected, timesteps)
total_final_infected += sum(final_states)
avg_final_infected = total_final_infected / num_simulations
threshold_results.append((p, avg_final_infected))
return threshold_results
# 构建多路网络,这里使用简单的随机图作为示例
num_layers = 2
layer_size = 100
p_edge = 0.1
networks = []
for _ in range(num_layers):
network = nx.erdos_renyi_graph(layer_size, p_edge)
networks.append(network)
# 将多个网络叠加成多路网络
multiplex_network = nx.disjoint_union_all(networks)
# 设置参数和初始感染节点
p_range = np.linspace(0, 0.5, 6)
q = 0.1
initial_infected = [0, 1]
timesteps = 100
num_simulations = 100
# 计算传播阈值
threshold_results = calculate_threshold(multiplex_network, p_range, q, initial_infected, timesteps, num_simulations)
# 输出结果
for threshold in threshold_results:
print("p:", threshold[0], "Average Final Infected:", threshold[1])