File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ def set_initial_status(self, configuration):
160160 if 'percentage_infected' in self .params ['model' ]:
161161 self .params ['model' ]['fraction_infected' ] = self .params ['model' ]['percentage_infected' ]
162162 if 'fraction_infected' in self .params ['model' ]:
163- number_of_initial_infected = len ( self .graph .nodes () ) * float (self .params ['model' ]['fraction_infected' ])
163+ number_of_initial_infected = self .graph .number_of_nodes ( ) * float (self .params ['model' ]['fraction_infected' ])
164164 if number_of_initial_infected < 1 :
165165 warnings .warn (
166166 "The fraction_infected value is too low given the number of nodes of the selected graph: a "
@@ -228,7 +228,7 @@ def reset(self, infected_nodes=None):
228228 if 'fraction_infected' in self .params ['model' ]:
229229 for n in self .status :
230230 self .status [n ] = 0
231- number_of_initial_infected = len ( self .graph .nodes () ) * float (self .params ['model' ]['fraction_infected' ])
231+ number_of_initial_infected = self .graph .number_of_nodes ( ) * float (self .params ['model' ]['fraction_infected' ])
232232 available_nodes = [n for n in self .status if self .status [n ] == 0 ]
233233 sampled_nodes = np .random .choice (available_nodes , int (number_of_initial_infected ), replace = False )
234234
You can’t perform that action at this time.
0 commit comments