Network implements Iterable<Neuron>,
               Serializable { public void deleteNeuron(Neuron neuron) { final Collection<Neuron> neighbours = getNeighbours(neuron); for (Neuron n : neighbours) { deleteLink(n, neuron); } neuronMap.remove(neuron.getIdentifier()); } Network(long nextId,
            int featureSize,
            Neuron[] neuronList,
            long[][] neighbourIdList);  Network(long initialIdentifier,
                   int featureSize); Iterator<Neuron> iterator(); Collection<Neuron> getNeurons(Comparator<Neuron> comparator); long createNeuron(double[] features); void deleteNeuron(Neuron neuron); int getFeaturesSize(); void addLink(Neuron a,
                        Neuron b); void deleteLink(Neuron a,
                           Neuron b); Neuron getNeuron(long id); Collection<Neuron> getNeighbours(Iterable<Neuron> neurons); Collection<Neuron> getNeighbours(Iterable<Neuron> neurons,
                                            Iterable<Neuron> exclude); Collection<Neuron> getNeighbours(Neuron neuron); Collection<Neuron> getNeighbours(Neuron neuron,
                                            Iterable<Neuron> exclude);  }
@Test public void testDeleteNeuron() { final FeatureInitializer[] initArray = { init }; final Network net = new NeuronSquareMesh2D(2, false, 2, false, SquareNeighbourhood.VON_NEUMANN, initArray).getNetwork(); Assert.assertEquals(2, net.getNeighbours(net.getNeuron(0)).size()); Assert.assertEquals(2, net.getNeighbours(net.getNeuron(3)).size()); net.deleteNeuron(net.getNeuron(1)); try { net.getNeuron(1); } catch (NoSuchElementException expected) {} Assert.assertEquals(1, net.getNeighbours(net.getNeuron(0)).size()); Assert.assertEquals(1, net.getNeighbours(net.getNeuron(3)).size()); }