Skip to content
Snippets Groups Projects
Commit 3c446d4e authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Fixes NCF in HCBF

parent 78a42df2
No related branches found
No related tags found
1 merge request!3Version 0.2
......@@ -114,7 +114,7 @@ class EpochCommunity(TickProcess):
def get_ncf(self, x, c_y):
''''''
g = self.old_graph
if x not in c_y or x not in g:
if x not in g or x in c_y:
return 0
return sum([
g[x][y]['duration']
......
......@@ -49,7 +49,9 @@ def hcbf(self, packet, state):
return False
# lp(max_lp) == lp(self)
elif not_local_community:
return False
if not_local_community:
max_cbc = max(not_local_community, key=cbc)
if cbc(max_cbc) > cbc(self):
send(max_cbc, 'cbc')
......@@ -58,7 +60,8 @@ def hcbf(self, packet, state):
return False
# cbc(max_cbc) == cbc(self)
max_ncf = max(not_local_community, key=ncf)
if local_community:
max_ncf = max(local_community, key=ncf)
if ncf(max_ncf) > ncf(self):
send(max_ncf, 'ncf')
return True
......@@ -66,7 +69,6 @@ def hcbf(self, packet, state):
return False
# ncf(max_ncf) == ncf(self)
elif local_community:
max_ui = max(local_community, key=ui)
if ui(max_ui) > ui(self):
send(max_ui, 'ui_lonely')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment