# Can a crossover result in a node with no outgoing connections?

I'm currently implementing the original NEAT algorithm in Swift.

Looking at figure 4 in Stanley's original paper, it seems to me there is a chance that node 5 will have no (enabled) outgoing connection if parent 1 is assumed the fittest parent and the connection is randomly picked from parent 2.

Is my understanding of the crossover function correct and can it indeed result in a node with no outgoing connections?

The disabled/enabled bit in a connection gene indicates whether or not it should be expressed in the calculation of the network.

Here's an example:

This is a neural network and its corresponding connection genes which represent the layout of the network among other things. The top connection gene going from 1 -> 3 that has a weight of 0.1 is expressed in the calculation of the network. The bottom connection gene going from 2 -> 3 that has a weight of 0.4 is not expressed in the calculation of the network.

Calculating the network:

1633 * 0.1 = 163.3

Given the weights in the example the output of this network is 163.3

Hypothetically, if both connection genes had their enabled bit set to true (which can happen in the future, to quote the paper: "The disabled genes may become enabled again in future generations") then the output of the network would be:

(1633 * 0.1) + (10 * 0.4) = 167.3

To answer your question, the connection between two nodes still exists in the network regardless of whether the bit in the gene is enabled or disabled, but, if the bit in the gene is disabled it is not used when the output of the network is being calculated as I've shown above.