class  FloodingUpdate (NodeAlgorithm):
required_params = (‘dataKey’,)
default_params =
def  initializer (self):
  for  node  in  self.network.nodes():
   if  self.initiator_condition(node):
    msg = Message(destination=node,header=‘initialize’)
    self.network.outbox.insert(0,msg)
   node.status = ‘FLOODING
def  flooding(self, node, message):
  if  message.header==‘initialize’:
   node.send(Message(header=‘Flood’,
          data=self.initiator_data (node)))
  if  message.header==‘Flood’:
   updated_data = self.handle_flood_message (node,message)
   if  updated_data:
    node.send (Message(header=‘Flood’,
           data=updated_data))
STATUS = {‘FLOODING’: flooding,}
Listing 1: Generic flooding protocol. Function initializer is special function that is issuing spontaneous impulses in the form of initialize messages at the beginning of the algorithm execution.