def add_node(self, node):
other_nodes = [n for n in self.nodes() if n.id != node.id]<EOL>if len(self.nodes()) > <NUM_LIT:11>:<EOL><INDENT>parents = [max(other_nodes, key=attrgetter("<STR_LIT>"))]<EOL><DEDENT>else:<EOL><INDENT>parents = [n for n in other_nodes if isinstance(n, Source)]<EOL><DEDENT>for parent in parents:<EOL><INDENT>parent.connect(whom=node)<EOL><DEDENT>
Add an agent, connecting it to the previous node.