Minor fixes and changes
This commit is contained in:
parent
725077750c
commit
dc10f471cd
@ -28,7 +28,8 @@ def load_data(path):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
list_churned_peers = [20, 30, 40, 50, 60, 70, 80, 90, 100]
|
# list_churned_peers = [20, 30, 40, 50, 60, 70, 80, 90, 100]
|
||||||
|
list_churned_peers = [3, 5, 10]
|
||||||
iterations = 5
|
iterations = 5
|
||||||
def main():
|
def main():
|
||||||
# random but reproducible
|
# random but reproducible
|
||||||
@ -44,7 +45,7 @@ def main():
|
|||||||
known = Node('34.204.196.211', 9796)
|
known = Node('34.204.196.211', 9796)
|
||||||
known_r = RankedNode(known, initial_rank)
|
known_r = RankedNode(known, initial_rank)
|
||||||
g = build_graph(edges, initial_rank=initial_rank)
|
g = build_graph(edges, initial_rank=initial_rank)
|
||||||
cnt = 0
|
# cnt = 0
|
||||||
# destinations = []
|
# destinations = []
|
||||||
# for node in g:
|
# for node in g:
|
||||||
# destinations.append(node)
|
# destinations.append(node)
|
||||||
@ -53,8 +54,10 @@ def main():
|
|||||||
# break
|
# break
|
||||||
|
|
||||||
destinations = sample(list(g.nodes()), churned_peers)
|
destinations = sample(list(g.nodes()), churned_peers)
|
||||||
|
print(f'!!!!!! adding destinations: {destinations}')
|
||||||
for node in destinations:
|
for node in destinations:
|
||||||
g.add_edge(known_r, node)
|
g.add_edge(known_r, node)
|
||||||
|
# g.add_edge(node, known_r)
|
||||||
|
|
||||||
count_map = {}
|
count_map = {}
|
||||||
for node in g:
|
for node in g:
|
||||||
|
@ -10,7 +10,8 @@ def load_data(path):
|
|||||||
for file in glob.glob(path):
|
for file in glob.glob(path):
|
||||||
with open(file, 'r') as f:
|
with open(file, 'r') as f:
|
||||||
lines = list(map(lambda l: l.strip(), f))
|
lines = list(map(lambda l: l.strip(), f))
|
||||||
bucket = datetime.fromtimestamp(float(file[22:-4]))
|
ts = file.split('_')[-1][:-4]
|
||||||
|
bucket = datetime.fromtimestamp(float(ts))
|
||||||
data = {}
|
data = {}
|
||||||
data['avg_out'] = float(lines[1].split(': ')[1])
|
data['avg_out'] = float(lines[1].split(': ')[1])
|
||||||
data['min_out'] = float(lines[2].split(': ')[1].split(', ')[3][0:-1])
|
data['min_out'] = float(lines[2].split(': ')[1].split(', ')[3][0:-1])
|
||||||
@ -37,9 +38,10 @@ def load_data(path):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
for edges in [20, 30, 40, 50, 60, 70, 80, 90, 100]:
|
# for edges in [0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 130, 150, 200]:
|
||||||
|
for edges in [3, 5, 10]:
|
||||||
print(f'plotting for {edges} edges')
|
print(f'plotting for {edges} edges')
|
||||||
all_data = load_data(f'./churn_rank/{edges}*')
|
all_data = load_data(f'./churn_rank/{edges}_*')
|
||||||
x = []
|
x = []
|
||||||
avg_out = []
|
avg_out = []
|
||||||
min_out = []
|
min_out = []
|
||||||
@ -105,6 +107,7 @@ def main():
|
|||||||
ax.plot(x, sr_perc_80, label='sr_perc_80')
|
ax.plot(x, sr_perc_80, label='sr_perc_80')
|
||||||
ax.plot(x, sr_perc_90, label='sr_perc_90')
|
ax.plot(x, sr_perc_90, label='sr_perc_90')
|
||||||
ax.plot(x, sr_perc_95, label='sr_perc_95')
|
ax.plot(x, sr_perc_95, label='sr_perc_95')
|
||||||
|
ax.plot(x, avg_sr, label='avg_sr')
|
||||||
|
|
||||||
ax.set_title(f'SensorRank after adding {edges} edges')
|
ax.set_title(f'SensorRank after adding {edges} edges')
|
||||||
fig.autofmt_xdate()
|
fig.autofmt_xdate()
|
||||||
@ -122,6 +125,7 @@ def main():
|
|||||||
ax.plot(x, pr_perc_80, label='pr_perc_80')
|
ax.plot(x, pr_perc_80, label='pr_perc_80')
|
||||||
ax.plot(x, pr_perc_90, label='pr_perc_90')
|
ax.plot(x, pr_perc_90, label='pr_perc_90')
|
||||||
ax.plot(x, pr_perc_95, label='pr_perc_95')
|
ax.plot(x, pr_perc_95, label='pr_perc_95')
|
||||||
|
ax.plot(x, avg_pr, label='avg_pr')
|
||||||
|
|
||||||
ax.set_title(f'PageRank after adding {edges} edges')
|
ax.set_title(f'PageRank after adding {edges} edges')
|
||||||
fig.autofmt_xdate()
|
fig.autofmt_xdate()
|
||||||
|
Loading…
Reference in New Issue
Block a user