Closed SaicharanRitwik39 closed 1 month ago
Hello. I have been able to solve this issue. For anyone working with empirical networks, I have been running into the following issue.
GSNAPFB = nx.read_edgelist('facebook_combined.txt', create_using=nx.Graph())
H = nx.DiGraph()
H.add_edge('I', 'R', rate = 1.4)
H.add_edge('R', 'S', rate = 0.2)
J = nx.DiGraph()
J.add_edge(('I', 'S'), ('I', 'I'), rate = 1)
IC = defaultdict(lambda: 'S')
for node in range(200):
IC[node] = 'I'
return_statuses = ('S', 'I', 'R')
t, S, I, R = EoN.Gillespie_simple_contagion(GSNAPFB, H, J, IC, return_statuses, tmax = 30)
This apparently does not run at all. This is most likely because of some node label misalignment. However, one fix that worked for me is the following:
nodes = list(GSNAPFB.nodes()) random.shuffle(nodes) IC = defaultdict(lambda: 'S') for node in nodes[:200]: IC[node] = 'I'
I hope this helps anyone who might be facing a similar issue.
Thanks for this.
I can add that if you're using a network of your own, then the N and G defined in this code should be removed (they aren't needed).
It's probably also worth thinking about what the initial condition should be as opposed to following the specific example and infecting a random set of 200. Are there certain individuals who you think should be initial infections? Or would you rather consider just one random initial infection?
thanks, Joel
Agreed, I’ve made the required edit to the original post. I used the code above as an example of resolution. In my case, I aim to randomly infect a certain percentage of the population for my model simulation.
Thanks for the inputs! Saicharan.
Hello! I have been trying to use EoN to create a custom model for analyzing smoking dynamics. Currently I am trying to run simulations on real world datasets. I am using data from the KONECT website. The simulations seem to run for the Powergrid Dataset (http://konect.cc/networks/opsahl-powergrid/) and BrightKite Dataset (http://konect.cc/networks/loc-brightkite_edges/). But when it comes to the FB dataset (http://konect.cc/networks/ego-facebook/), I just get flat lines.
Any reasons/roundabouts would be highly appreciated.