public void buildNetwork(){
  Neuron firstNeuron=new Neuron(network,DEFAULT_NEURON_TYPE);
  List<Neuron> currentLayer=new ArrayList<Neuron>();
  firstNeuron.setPosition(initialPosition);
  currentLayer.add(firstNeuron);
  int numNeuronsLastLayer=(int)Math.pow(numBrachesPerNeuron,numLayers);
  double totalSpace=numNeuronsLastLayer * horizontalSpacing;
  for (int layerIndex=1; layerIndex <= numLayers; layerIndex++) {
    List<Neuron> tempList=new ArrayList<Neuron>();
    double layerSpacing=totalSpace / (int)Math.pow(numBrachesPerNeuron,layerIndex);
    double branchWidth=layerSpacing * (numBrachesPerNeuron - 1);
    for (    Neuron baseNeuron : currentLayer) {
      network.addNeuron(baseNeuron);
      double initialXOffset=branchWidth / 2;
      for (int j=0; j < numBrachesPerNeuron; j++) {
        Neuron targetNeuron=new Neuron(network,new LinearRule());
        targetNeuron.setLocation(baseNeuron.getX() - initialXOffset + (j * layerSpacing),initialPosition.y - (layerIndex * verticalSpacing));
        tempList.add(targetNeuron);
        network.addNeuron(targetNeuron);
        targetNeuron.setUpdatePriority(layerIndex);
        Synapse synapse=new Synapse(network,baseNeuron,targetNeuron,new StaticSynapseRule());
        network.addSynapse(synapse);
      }
    }
    currentLayer=tempList;
  }
}

public void buildNetwork ( ) { Neuron firstNeuron = new Neuron ( network , DEFAULT_NEURON_TYPE ) ; List < Neuron > currentLayer = new ArrayList < Neuron > ( ) ; firstNeuron . setPosition ( initialPosition ) ; currentLayer . add ( firstNeuron ) ; int numNeuronsLastLayer = ( int ) Math . pow ( numBrachesPerNeuron , numLayers ) ; double totalSpace = numNeuronsLastLayer * horizontalSpacing ; for ( int layerIndex = 1 ; layerIndex <= numLayers ; layerIndex ++ ) { List < Neuron > tempList = new ArrayList < Neuron > ( ) ; double layerSpacing = totalSpace / ( int ) Math . pow ( numBrachesPerNeuron , layerIndex ) ; double branchWidth = layerSpacing * ( numBrachesPerNeuron - 1 ) ; for ( Neuron baseNeuron : currentLayer ) { network . addNeuron ( baseNeuron ) ; double initialXOffset = branchWidth / 2 ; for ( int j = 0 ; j < numBrachesPerNeuron ; j ++ ) { Neuron targetNeuron = new Neuron ( network , new LinearRule ( ) ) ; targetNeuron . setLocation ( baseNeuron . getX ( ) - initialXOffset + ( j * layerSpacing ) , initialPosition . y - ( layerIndex * verticalSpacing ) ) ; tempList . add ( targetNeuron ) ; network . addNeuron ( targetNeuron ) ; targetNeuron . setUpdatePriority ( layerIndex ) ; Synapse synapse = new Synapse ( network , baseNeuron , targetNeuron , new StaticSynapseRule ( ) ) ; network . addSynapse ( synapse ) ; } } currentLayer = tempList ; } }
create the cascading network .
