def add_node_to_network(self, node, network):
network.add_node(node)<EOL>node.receive()<EOL>environment = network.nodes(type=self.models.RogersEnvironment)[<NUM_LIT:0>]<EOL>environment.connect(whom=node)<EOL>gene = node.infos(type=self.models.LearningGene)[<NUM_LIT:0>].contents<EOL>if gene == "<STR_LIT>":<EOL><INDENT>agent_model = self.models.RogersAgent<EOL>prev_agents = agent_model.query.filter_by(<EOL>failed=False, network_id=network.id, generation=node.generation - <NUM_LIT:1><EOL>).all()<EOL>parent = random.choice(prev_agents)<EOL>parent.connect(whom=node)<EOL>parent.transmit(what=Meme, to_whom=node)<EOL><DEDENT>elif gene == "<STR_LIT>":<EOL><INDENT>environment.transmit(to_whom=node)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(node, gene)<EOL>)<EOL><DEDENT>node.receive()<EOL>
Add participant's node to a network.