genome.py
def creates_cycle(self, node_in_id, node_out_id):
        """
        Checks if the addition of a connection gene will create a cycle in the computation graph
        :param node_in_id: In node of the connection gene
        :param node_out_id: Out node of the connection gene
        :return: Boolean value
        """
        if node_in_id == node_out_id:
            return True

        visited = {node_out_id}
        while True:
            num_added = 0

            for c_gene in self.connection_genes:
                if c_gene.in_node_id in visited and c_gene.out_node_id not in visited:

                    if c_gene.out_node_id == node_in_id:
                        return True
                    else:
                        visited.add(c_gene.out_node_id)
                        num_added += 1

            if num_added == 0:
                return False

        Checks if the addition of a connection gene will create a cycle in the computation graph
        :param node_in_id: In node of the connection gene
        :param node_out_id: Out node of the connection gene
        :return: Boolean value
        
Checks if the addition of a connection gene will create a cycle in the computation graph
Checks if the addition of a connection gene will create a cycle in the computation graph
def creates_cycle(self, node_in_id, node_out_id):
        if node_in_id == node_out_id:
            return True
        visited = {node_out_id}
        while True:
            num_added = 0
            for c_gene in self.connection_genes:
                if c_gene.in_node_id in visited and c_gene.out_node_id not in visited:
                    if c_gene.out_node_id == node_in_id:
                        return True
                    else:
                        visited.add(c_gene.out_node_id)
                        num_added += 1
            if num_added == 0:
                return False
def creates_cycle ( self , node_in_id , node_out_id ) : if node_in_id == node_out_id : return True visited = { node_out_id } while True : num_added = 0 for c_gene in self . connection_genes : if c_gene . in_node_id in visited and c_gene . out_node_id not in visited : if c_gene . out_node_id == node_in_id : return True else : visited . add ( c_gene . out_node_id ) num_added += 1 if num_added == 0 : return False
Checks if the addition of a connection gene will create a cycle in the computation graph
Checks if the addition of a connection gene will create a cycle in the computation graph
"""
        Checks if the addition of a connection gene will create a cycle in the computation graph
        :param node_in_id: In node of the connection gene
        :param node_out_id: Out node of the connection gene
        :return: Boolean value
        """
None
self
node_in_id
In node of the connection gene
In node of the connection gene
node_out_id
Out node of the connection gene
Out node of the connection gene