public void HandleNode(Node current, Node origin, Message message, Network network) { foreach (Node neighbor in current.neighbors) { network.Enqueue(message, current, neighbor); } }
public void HandleNode(Node current, Node origin, Message message, Network network) { if (message.hops >= k && random.NextDouble() > p) { return; } foreach (Node neighbor in current.neighbors) { network.Enqueue(message, current, neighbor); } }
public void OnTimeStep(Network network) { foreach (Node node in network.nodes) { if (node.broadcasted == false && node.messagesReceived <= m && node.messagesReceived > 0 && node.rcvTime + timeout < network.time) { node.broadcasted = true; foreach (Node neighbor in node.neighbors) { network.Enqueue(node.message, node, neighbor); } } } }