Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRossetti committed May 29, 2017
1 parent e2967be commit f9ec870
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 19 deletions.
23 changes: 21 additions & 2 deletions docs/reference/models/epidemics/SIR.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,28 @@ SIR assumes that if, during a generic iteration, a susceptible node comes into c
.. autoclass:: ndlib.models.epidemics.SIRModel.SIRModel
.. automethod:: ndlib.models.epidemics.SIRModel.SIRModel.__init__(graph)

=======

----------
Parameters
----------

===== ===== =============== ======= ========= =====================
Name Type Value Type Default Mandatory Description
===== ===== =============== ======= ========= =====================
beta Model float in [0, 1] True Infection probability
gamma Model float in [0, 1] True Removal probability
===== ===== =============== ======= ========= =====================

The initial infection status can be defined via:

- **percentage_infected**: Model Parameter, float in [0, 1]
- **Infected**: Status Parameter, set of nodes

The two options are mutually exclusive and the latter takes precedence over the former.

-------
Example
=======
-------

In the code below is shown an example of istantiation and execution of an SIR simultion on a random graph: we set the initial set of infected nodes as 5% of the overall population, a probability of infection of 1%, and a removal probability of 0.5%.

Expand Down
22 changes: 20 additions & 2 deletions docs/reference/models/epidemics/SIS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,27 @@ SIS assumes that if, during a generic iteration, a susceptible node comes into c
.. autoclass:: ndlib.models.epidemics.SISModel.SISModel
.. automethod:: ndlib.models.epidemics.SISModel.SISModel.__init__(graph)

=======
----------
Parameters
----------

====== ===== =============== ======= ========= =====================
Name Type Value Type Default Mandatory Description
====== ===== =============== ======= ========= =====================
beta Model float in [0, 1] True Infection probability
lambda Model float in [0, 1] True Recovery probability
====== ===== =============== ======= ========= =====================

The initial infection status can be defined via:

- **percentage_infected**: Model Parameter, float in [0, 1]
- **Infected**: Status Parameter, set of nodes

The two options are mutually exclusive and the latter takes precedence over the former.

-------
Example
=======
-------

In the code below is shown an example of istantiation and execution of an SIS simultion on a random graph: we set the initial set of infected nodes as 5% of the overall population, a probability of infection of 1%, and a probability of recovery of 0.5%.

Expand Down
21 changes: 19 additions & 2 deletions docs/reference/models/epidemics/SIm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,26 @@ SI assumes that if, during a generic iteration, a susceptible node comes into co
.. autoclass:: ndlib.models.epidemics.SIModel.SIModel
.. automethod:: ndlib.models.epidemics.SIModel.SIModel.__init__(graph)

=======
----------
Parameters
----------

===== ===== =============== ======= ========= =====================
Name Type Value Type Default Mandatory Description
===== ===== =============== ======= ========= =====================
beta Model float in [0, 1] True Infection probability
===== ===== =============== ======= ========= =====================

The initial infection status can be defined via:

- **percentage_infected**: Model Parameter, float in [0, 1]
- **Infected**: Status Parameter, set of nodes

The two options are mutually exclusive and the latter takes precedence over the former.

-------
Example
=======
-------

In the code below is shown an example of istantiation and execution of an SI simultion on a random graph: we set the initial set of infected nodes as 5% of the overall population and a probability of infection of 1%.

Expand Down
3 changes: 2 additions & 1 deletion ndlib/models/DiffusionModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class DiffusionModel(object):

def __init__(self, graph):
"""
Model Constructor
:rtype: object
:param graph: A networkx graph object
"""
self.discrete_state = True

Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/IndependentCascadesModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/KerteszThresholdModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/ProfileModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/ProfileThresholdModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/SIModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/SIRModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/epidemics/SISModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
5 changes: 5 additions & 0 deletions ndlib/models/epidemics/ThresholdModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class ThresholdModel(DiffusionModel):
"""

def __init__(self, graph):
"""
Model Constructor
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
"Susceptible": 0,
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/opinions/CognitiveOpDynModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)

Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/opinions/MajorityRuleModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/opinions/QVoterModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/opinions/SznajdModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down
2 changes: 1 addition & 1 deletion ndlib/models/opinions/VoterModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, graph):
"""
Model Constructor
:param graph: An networkx graph object
:param graph: A networkx graph object
"""
super(self.__class__, self).__init__(graph)
self.available_statuses = {
Expand Down

0 comments on commit f9ec870

Please sign in to comment.