Program: 17649
Project: 17649
Buggy source:
private Graph<DrawnNeuron,DrawnConnection> buildGraph(NEATGenome genome){
  int inputCount=1;
  int outputCount=1;
  int hiddenCount=1;
  int biasCount=1;
  List<DrawnNeuron> neurons=new ArrayList<DrawnNeuron>();
  Graph<DrawnNeuron,DrawnConnection> result=new SparseMultigraph<DrawnNeuron,DrawnConnection>();
  List<DrawnNeuron> connections=new ArrayList<DrawnNeuron>();
  Map<Integer,DrawnNeuron> neuronMap=new HashMap<Integer,DrawnNeuron>();
  for (  Gene obj : genome.getNeurons().getGenes()) {
    NEATNeuronGene neuronGene=(NEATNeuronGene)obj;
    String name="String_Node_Str";
    DrawnNeuronType t=DrawnNeuronType.Hidden;
switch (neuronGene.getNeuronType()) {
case Bias:
      t=DrawnNeuronType.Bias;
    name="String_Node_Str" + (biasCount++);
  break;
case Input:
t=DrawnNeuronType.Input;
name="String_Node_Str" + (inputCount++);
break;
case Output:
t=DrawnNeuronType.Output;
name="String_Node_Str" + (outputCount++);
break;
case Hidden:
t=DrawnNeuronType.Hidden;
name="String_Node_Str" + (hiddenCount++);
break;
}
DrawnNeuron neuron=new DrawnNeuron(t,name,neuronGene.getSplitY(),neuronGene.getSplitX());
neurons.add(neuron);
neuronMap.put((int)neuronGene.getId(),neuron);
}
for (Gene obj : genome.getLinks().getGenes()) {
NEATLinkGene neatLinkGene=(NEATLinkGene)obj;
DrawnNeuron fromNeuron=neuronMap.get((int)neatLinkGene.getFromNeuronID());
DrawnNeuron toNeuron=neuronMap.get((int)neatLinkGene.getToNeuronID());
DrawnConnection connection=new DrawnConnection(fromNeuron,toNeuron,neatLinkGene.getWeight());
fromNeuron.getOutbound().add(connection);
toNeuron.getInbound().add(connection);
}
for (DrawnNeuron neuron : neurons) {
result.addVertex(neuron);
for (DrawnConnection connection : neuron.getOutbound()) {
result.addEdge(connection,connection.getFrom(),connection.getTo(),EdgeType.DIRECTED);
}
}
return result;
}

Fixed version (ground truth):
private Graph<DrawnNeuron,DrawnConnection> buildGraph(NEATGenome genome){
  int inputCount=1;
  int outputCount=1;
  int hiddenCount=1;
  int biasCount=1;
  List<DrawnNeuron> neurons=new ArrayList<DrawnNeuron>();
  Graph<DrawnNeuron,DrawnConnection> result=new SparseMultigraph<DrawnNeuron,DrawnConnection>();
  List<DrawnNeuron> connections=new ArrayList<DrawnNeuron>();
  Map<Integer,DrawnNeuron> neuronMap=new HashMap<Integer,DrawnNeuron>();
  for (  NEATNeuronGene neuronGene : genome.getNeuronsChromosome()) {
    String name="String_Node_Str";
    DrawnNeuronType t=DrawnNeuronType.Hidden;
switch (neuronGene.getNeuronType()) {
case Bias:
      t=DrawnNeuronType.Bias;
    name="String_Node_Str" + (biasCount++);
  break;
case Input:
t=DrawnNeuronType.Input;
name="String_Node_Str" + (inputCount++);
break;
case Output:
t=DrawnNeuronType.Output;
name="String_Node_Str" + (outputCount++);
break;
case Hidden:
t=DrawnNeuronType.Hidden;
name="String_Node_Str" + (hiddenCount++);
break;
}
DrawnNeuron neuron=new DrawnNeuron(t,name,neuronGene.getSplitY(),neuronGene.getSplitX());
neurons.add(neuron);
neuronMap.put((int)neuronGene.getId(),neuron);
}
for (Gene obj : genome.getLinksChromosome()) {
NEATLinkGene neatLinkGene=(NEATLinkGene)obj;
DrawnNeuron fromNeuron=neuronMap.get((int)neatLinkGene.getFromNeuronID());
DrawnNeuron toNeuron=neuronMap.get((int)neatLinkGene.getToNeuronID());
DrawnConnection connection=new DrawnConnection(fromNeuron,toNeuron,neatLinkGene.getWeight());
fromNeuron.getOutbound().add(connection);
toNeuron.getInbound().add(connection);
}
for (DrawnNeuron neuron : neurons) {
result.addVertex(neuron);
for (DrawnConnection connection : neuron.getOutbound()) {
result.addEdge(connection,connection.getFrom(),connection.getTo(),EdgeType.DIRECTED);
}
}
return result;
}