Skip to content

Commit 39e9afb

Browse files
authored
Version 1.0
1 parent 65879b5 commit 39e9afb

File tree

5 files changed

+117
-36
lines changed

5 files changed

+117
-36
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Optimized Gillespie algorithms for the efficient simulation of Markovian epidemic processes on large and heterogeneous networks: SIS-OGA
1+
# Optimized Gillespie algorithms for the simulation of Markovian epidemic processes on large and heterogeneous networks: SIS-OGA
2+
3+
This code is part of the article "[Optimized Gillespie algorithms for the simulation of Markovian epidemic processes on large and heterogeneous networks](http://wesleycota.com/)"
24

35
### Python implementation
46

@@ -12,7 +14,7 @@
1214

1315
## Synopsis
1416

15-
This code is a implementation of the SIS-OGA algorithm, as detailed in our paper (to be cited). It receives as input a network file, containing a list of edges and read, via terminal, the dynamical parameters.
17+
This code is a implementation of the SIS-OGA algorithm, as detailed in our [paper](http://wesleycota.com/). It receives as input a network file, containing a list of edges and read, via terminal, the dynamical parameters.
1618

1719
For performance, see https://github.com/wcota/dynSIS (Fortran implementation)
1820

dynamics.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# ! ## See README.md for more information and use
44
# !-----------------------------------------------------------------------------
55
# ! SIS epidemic model algorithm based on the article
6-
# ! "Optimized Gillespie algorithms for the efficient simulation of
7-
# ! Markovian epidemic processes on large and heterogeneous networks"
6+
# ! "Optimized Gillespie algorithms for the simulation of Markovian
7+
# ! epidemic processes on large and heterogeneous networks"
88
# ! Copyright (C) 2017 Wesley Cota, Silvio C. Ferreira
99
# !
10-
# ! Please cite the above cited paper as reference to our code.
10+
# ! Please cite the above cited paper (available at <http://wesleycota.com/ ) as reference
11+
# ! to our code.
1112
# !
1213
# ! This program is free software: you can redistribute it and/or modify
1314
# ! it under the terms of the GNU General Public License as published by
@@ -24,8 +25,8 @@
2425
# !-----------------------------------------------------------------------------
2526
# ! Author : Wesley Cota
2627
# ! Email : wesley.cota@ufv.br
27-
# ! Date : 10 Mar 2017
28-
# ! Version : 0.2
28+
# ! Date : 27 Mar 2017
29+
# ! Version : 1.0
2930
# !-----------------------------------------------------------------------------
3031
# ! See README.md for more details
3132
# ! This code is available at <https://github.com/wcota/dynSIS-py>
@@ -37,7 +38,17 @@
3738
from math import log
3839
import sys
3940

40-
print_header()
41+
print( '################################################################################',
42+
'######### Optimized Gillespie algorithms for the simulation of Markovian ######',
43+
'####### epidemic processes on large and heterogeneous networks: SIS-OGA. #######',
44+
'##============ Copyright (C) 2017 Wesley Cota, Silvio C. Ferreira ============##',
45+
'##================ Paper available at <http://wesleycota.com/ ================##',
46+
'##======= The codes are available at <https://github.com/wcota/dynSIS> =======##',
47+
'##======== Please cite the above cited paper as reference to our code ========##',
48+
'##=== This code is under GNU General Public License. Please see README.md. ===##',
49+
'################################################################################',
50+
'',
51+
sep='\n')
4152

4253
# READING PARAMETERS
4354
if len(sys.argv) < 3:
@@ -162,7 +173,8 @@
162173

163174
# Write output file
164175
flOutput = open(fnOutput, 'wt')
165-
print( '#@ Network file: '+fnInput,
176+
print( '## ***** Algorithm used: Optimized Gillespie Algorithm for SIS (SIS-OGA, Python) *****',
177+
'#@ Network file: '+fnInput,
166178
'#@ Number of nodes: '+str(netw.size),
167179
'#@ Number of edges: '+str(netw.skk),
168180
'#@ Samples: '+str(dynp_sam),
@@ -181,6 +193,10 @@
181193
flOutput.close()
182194
# / RUNNING DYNAMICS
183195

196+
print_info('')
184197
print_info('Everything ok!',True)
185198
print_info('Input file (edges list): '+ fnInput)
186199
print_info('Output file: '+ fnOutput)
200+
print_info('')
201+
print_info('*****Algorithm used: Optimized Gillespie Algorithm for SIS (SIS-OGA, Python)*****')
202+
print_info('Codes available at <https://github.com/wcota/dynSIS>.')

network.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
# ! ## See README.md for more information and use
55
# !-----------------------------------------------------------------------------
66
# ! SIS epidemic model algorithm based on the article
7-
# ! "Optimized Gillespie algorithms for the efficient simulation of
8-
# ! Markovian epidemic processes on large and heterogeneous networks"
7+
# ! "Optimized Gillespie algorithms for the simulation of Markovian
8+
# ! epidemic processes on large and heterogeneous networks"
99
# ! Copyright (C) 2017 Wesley Cota, Silvio C. Ferreira
1010
# !
11-
# ! Please cite the above cited paper as reference to our code.
11+
# ! Please cite the above cited paper (available at <http://wesleycota.com/ ) as reference
12+
# ! to our code.
1213
# !
1314
# ! This program is free software: you can redistribute it and/or modify
1415
# ! it under the terms of the GNU General Public License as published by
@@ -25,8 +26,8 @@
2526
# !-----------------------------------------------------------------------------
2627
# ! Author : Wesley Cota
2728
# ! Email : wesley.cota@ufv.br
28-
# ! Date : 10 Mar 2017
29-
# ! Version : 0.2
29+
# ! Date : 27 Mar 2017
30+
# ! Version : 1.0
3031
# !-----------------------------------------------------------------------------
3132
# ! See README.md for more details
3233
# ! This code is available at <https://github.com/wcota/dynSIS-py>

saida.dat

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
## ***** Algorithm used: Optimized Gillespie Algorithm for SIS (SIS-OGA, Python) *****
2+
#@ Network file: ../s01.edges.dat
3+
#@ Number of nodes: 1000
4+
#@ Number of edges: 5194
5+
#@ Samples: 100
6+
#! Infection rate (lambda): 0.12
7+
#! Maximum time steps: 100000
8+
#! Fraction of infected vertices (initial condition): 1.0
9+
1.00352972966 0.44824
10+
2.00499799431 0.24959
11+
3.00704023407 0.15691
12+
4.01001232771 0.10614
13+
5.01577421927 0.07921
14+
6.01609706905 0.0604
15+
7.02307735175 0.04713
16+
8.04162008125 0.03823
17+
9.0896170984 0.03011
18+
10.1002839368 0.02493
19+
11.1004329189 0.02157
20+
12.126221364 0.0183
21+
13.0989557029 0.01639
22+
14.0978684298 0.0143
23+
15.1670344282 0.0122
24+
16.1680031981 0.01019
25+
17.198487686 0.00858
26+
18.1754388668 0.00719
27+
19.23483838 0.00651
28+
20.2052089979 0.0061
29+
21.2348967268 0.00514
30+
22.2493223728 0.00424
31+
23.1905867937 0.00376
32+
24.18701619 0.00315
33+
25.2296574833 0.00251
34+
26.201148954 0.00266
35+
27.201825163 0.00226
36+
28.0779979196 0.00216
37+
29.4279870216 0.00164
38+
30.4486392255 0.00174
39+
31.3286636469 0.00173
40+
32.5629792245 0.00148
41+
33.3235209261 0.00125
42+
34.1923405827 0.00122
43+
35.1393685318 0.00101
44+
36.1865645312 0.00072
45+
37.1201577327 0.0006
46+
38.2781095783 0.00046
47+
39.0241456601 0.0005
48+
40.1539064218 0.00044
49+
41.1021747133 0.00049
50+
42.2467154855 0.00034
51+
43.4352451344 0.00034
52+
44.1380860192 0.00028
53+
45.1787946027 0.0002
54+
46.0883031418 0.00032
55+
47.2589765801 0.00028
56+
48.5505203581 0.00023
57+
49.1443231985 0.00025
58+
50.0515121313 0.00023
59+
51.0417713446 0.00019
60+
52.0895263144 0.00018
61+
53.0030927503 0.00016
62+
54.0241556001 0.00023
63+
55.0287812782 0.00027
64+
56.0163104215 0.00026
65+
57.0794846247 0.00012
66+
58.0193112177 0.00023
67+
59.0065588239 0.00031
68+
60.0017457919 0.0004
69+
61.0472794528 0.00035
70+
62.0494306342 0.00033
71+
63.0045712802 0.00038
72+
64.0073553421 0.00031
73+
65.0874090484 0.00012
74+
66.0874026347 0.0001
75+
67.1585283646 6e-05

tools.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env python
22
# ! ## File: tools.py
33
# ! ## Print and read functions.
4-
# ! ## See README.md for more information and use
5-
# !-----------------------------------------------------------------------------
4+
# ! ## See README.md for more information and use# !-----------------------------------------------------------------------------
65
# ! SIS epidemic model algorithm based on the article
7-
# ! "Optimized Gillespie algorithms for the efficient simulation of
8-
# ! Markovian epidemic processes on large and heterogeneous networks"
6+
# ! "Optimized Gillespie algorithms for the simulation of Markovian
7+
# ! epidemic processes on large and heterogeneous networks"
98
# ! Copyright (C) 2017 Wesley Cota, Silvio C. Ferreira
109
# !
11-
# ! Please cite the above cited paper as reference to our code.
10+
# ! Please cite the above cited paper (available at <http://wesleycota.com/ ) as reference
11+
# ! to our code.
1212
# !
1313
# ! This program is free software: you can redistribute it and/or modify
1414
# ! it under the terms of the GNU General Public License as published by
@@ -25,8 +25,8 @@
2525
# !-----------------------------------------------------------------------------
2626
# ! Author : Wesley Cota
2727
# ! Email : wesley.cota@ufv.br
28-
# ! Date : 10 Mar 2017
29-
# ! Version : 0.2
28+
# ! Date : 27 Mar 2017
29+
# ! Version : 1.0
3030
# !-----------------------------------------------------------------------------
3131
# ! See README.md for more details
3232
# ! This code is available at <https://github.com/wcota/dynSIS-py>
@@ -40,18 +40,5 @@ def print_error(st):
4040
def print_info(st,nl=False):
4141
if nl:
4242
print('')
43-
print('$!', st, '!$')
44-
45-
def print_header():
46-
47-
48-
print( '################################################################################',
49-
'### Optimized Gillespie algorithms for the efficient simulation of Markovian ###',
50-
'####### epidemic processes on large and heterogeneous networks: SIS-OGA. #######',
51-
'##============ Copyright (C) 2017 Wesley Cota, Silvio C. Ferreira ============##',
52-
'##======= This code is available at <https://github.com/wcota/dynSIS>. =======##',
53-
'##======== Please cite the above cited paper as reference to our code ========##',
54-
'##=== This code is under GNU General Public License. Please see README.md. ===##',
55-
'################################################################################',
56-
'',
57-
sep='\n')
43+
print('$!', st)
44+

0 commit comments

Comments
 (0)