Skip to content

Commit

Permalink
fixed cidonDfs algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
ufukygmr committed May 6, 2022
1 parent 669b389 commit f2833ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions adhoccomputing/DistributedAlgorithms/Waves/CidonDFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class NodeMark(Enum):
father = "father"
son = "son"

topo = Topology()

# define your own message header structure
class ApplicationLayerMessageHeader(GenericMessageHeader):
pass
Expand All @@ -51,7 +49,7 @@ class ApplicationLayerComponent_Cidon(GenericModel):

def on_init(self, eventobj: Event):
print(f"Initializing {self.componentname}.{self.componentinstancenumber}")
self.NeighbourList = topo.get_neighbors(self.componentinstancenumber)
self.NeighbourList = self.topology.get_neighbors(self.componentinstancenumber)
self.state = NodeState.IDLE
self.mark = {}
for i in self.NeighbourList:
Expand Down Expand Up @@ -160,10 +158,11 @@ def Search(self):
print(f"I am Node-{self.componentinstancenumber} local number messages sent is {self.numMesg}")
return

def __init__(self, componentname, componentinstancenumber):
def __init__(self, componentname, componentinstancenumber, topology=None):
super().__init__(componentname, componentinstancenumber)
self.eventhandlers["start"] = self.on_start
self.eventhandlers["token"] = self.on_token
self.eventhandlers["visited"] = self.on_visited
self.topology = topology


1 change: 1 addition & 0 deletions adhoccomputing/Experimentation/Topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class Topology:
nodes = {}
channels = {}
G = None

def __init__(self, name=None) -> None:
# print("Constructing topology", name)
Expand Down

0 comments on commit f2833ed

Please sign in to comment.