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

Re-implement HCBF

parent 9531e189
No related branches found
No related tags found
2 merge requests!3Version 0.2,!1Full rewrite
......@@ -343,4 +343,36 @@ class HCBFNode(CommunityNode):
if forward:
return forward
dest = packet.destination
if self.community is not dest.community:
if self.out_community_neighbours:
cbc = lambda n: self._community.community_betweenness(n, dest)
target = _decide(self,
self.out_community_neighbours,
cbc)
if not (target is None or target is self):
return {target: 'community-betweenness'}
if self.in_community_neighbours:
ncf = lambda n: self._community.nodal_contribution(n, dest)
target = _decide(self,
self.in_community_neighbours,
ncf)
if not (target is None or target is self):
return {target: 'nodal-contribution'}
if self.in_community_neighbours:
target = _decide(self,
self.in_community_neighbours,
self._community.unique_interactions)
if not (target is None or target is self):
return {target: 'unique-interactions'}
target = _decide(self,
self.in_community_neighbours,
self._community.local_popularity)
if not (target is None or target is self):
return {target: 'local-popularity'}
return {}
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