Skip to content
Snippets Groups Projects
Commit 04e5f2dd authored by ArktikHunter's avatar ArktikHunter
Browse files

forgot a file

parent 0752d04b
No related branches found
No related tags found
1 merge request!21pydtn agkmeans and version 1.0
Pipeline #10894 failed
......@@ -334,19 +334,19 @@ class CommunityNode(Node):
]
def shared_community(context, create):
"""
Check context for shared community and return a shared community.
def shared_community(context, create):
"""
Check context for shared community and return a shared community.
Use this for community detection algorithms that must have one instance
for a set of nodes.
"""
if "shared-community" in context:
return context["shared-community"]
Use this for community detection algorithms that must have one instance
for a set of nodes.
"""
if "shared-community" in context:
return context["shared-community"]
community = create()
context["shared-community"] = community
return community
community = create()
context["shared-community"] = community
return community
class LouvainNode(CommunityNode):
......@@ -403,25 +403,25 @@ class AGKmeansNode(CommunityNode):
super().__init__(**options)
def _decide(node, others, key):
"""
Make a decision on which node to send to best is decided based on key.
def _decide(node, others, key):
"""
Make a decision on which node to send to best is decided based on key.
If the best is better than node, return best.
If node is better than the best, return node.
If the best and node are equal, return None.
"""
best = max(others, key=key)
best_key = key(best)
node_key = key(node)
If the best is better than node, return best.
If node is better than the best, return node.
If the best and node are equal, return None.
"""
best = max(others, key=key)
best_key = key(best)
node_key = key(node)
if best_key > node_key:
return best
if best_key > node_key:
return best
if best_key < node_key:
return node
if best_key < node_key:
return node
return None
return None
class BubbleNode(CommunityNode):
......
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