/
mhrw_sample.py
46 lines (37 loc) · 1.65 KB
/
mhrw_sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
''' Helper library to generate statistics from graphsize.py '''
import mhrw
import graphsize
import plotter
def increasing_sample_size():
collected = {}
for sample_size in xrange(0, 30001, 5000):
if sample_size == 0: continue # ugly hack to skip first
collected[sample_size] = plotter.run(3, mhrw.gnutella_mhrw,
{'samples': sample_size,
'length': 300,
'thinning': 5})
return collected
def increasing_walk_length_sample_is_10000():
collected = {}
for walk in xrange(0,600,50):
if walk == 0: continue # ugly hack to skip first
collected[walk] = plotter.run(3, mhrw.gnutella_mhrw,
{'samples': 10000,
'length': walk,
'thinning': 5})
return collected
def increasing_thinning_sample_is_10000_walk_is_100():
collected = {}
for thinning in xrange(1,20,1):
collected[thinning] = plotter.run(1, mhrw.gnutella_mhrw,
{'samples': 10000,
'length': 300,
'thinning': thinning})
return collected
if '__main__' == __name__:
sample_size = increasing_sample_size()
plotter.print_data("mhrw_size.data", sample_size)
walk = increasing_walk_length_sample_is_10000()
plotter.print_data("mhrw_walk.data", walk)
thinning = increasing_thinning_sample_is_10000_walk_is_100()
plotter.print_data("mhrw_thinning.data", thinning)