<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r69035530">src/mlpack/methods/ne/neat.hpp</a>:</p>
<pre style='color:#555'>&gt; +
&gt; +  // Mutate: add new link to genome.
&gt; +  // TODO: what if created looped link? It will influence the depth calculation in genome class!!
&gt; +  // TODO: make innovation a class and pass as parameter? Also for other similar functions.
&gt; +  void MutateAddLink(Genome&amp; genome, double mutateAddLinkProb) {
&gt; +    // Whether mutate or not.
&gt; +    double p = mlpack::math::Random();
&gt; +    if (p &gt; mutateAddLinkProb) return;
&gt; +
&gt; +    // Select from neuron
&gt; +    ssize_t fromNeuronIdx = mlpack::math::RandInt(0, genome.aNeuronGenes.size());
&gt; +    ssize_t fromNeuronId = genome.aNeuronGenes[fromNeuronIdx].Id();
&gt; +
&gt; +    // Select to neuron which cannot be input.
&gt; +    ssize_t toNeuronIdx = mlpack::math::RandInt(genome.NumInput(), genome.aNeuronGenes.size());
&gt; +    ssize_t toNeuronId = genome.aNeuronGenes[toNeuronIdx].Id();
</pre>
<p>I think we have to make sure, that <code>fromNeuronIdx != toNeuronIdx</code>.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/686/files/3c109959da112cebba341ac1e5f0143a4d5a85f2#r69035530">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFEEJygJgXywhKtVVlsVkh4HXBIYpks5qQulYgaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFHCnSV0C_sezmCr85ArMTJpK08T7ks5qQulYgaJpZM4IwJa6.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/686/files/3c109959da112cebba341ac1e5f0143a4d5a85f2#r69035530"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>