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

Give nodes names

parent df61734d
No related branches found
No related tags found
2 merge requests!3Version 0.2,!1Full rewrite
...@@ -263,8 +263,10 @@ class Node: ...@@ -263,8 +263,10 @@ class Node:
class SendFailed(Exception): class SendFailed(Exception):
"""Raised when a send fails.""" """Raised when a send fails."""
def __init__(self, **options): def __init__(self, name, **options):
"""Create a node.""" """Create a node."""
self.name = name
self.network = None self.network = None
self.buffer = Buffer() self.buffer = Buffer()
......
...@@ -215,9 +215,9 @@ class LouvainCommunity(Community): ...@@ -215,9 +215,9 @@ class LouvainCommunity(Community):
class CommunityNode(Node): class CommunityNode(Node):
"""Base node for community based forwarding heuristics.""" """Base node for community based forwarding heuristics."""
def __init__(self, community=None, **options): def __init__(self, name, community=None, **options):
"""Create a community based node.""" """Create a community based node."""
super().__init__(**options) super().__init__(name, **options)
if community is None: if community is None:
raise ValueError('No community set') raise ValueError('No community set')
self._community = community self._community = community
......
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