The authors present an optimal clustering algorithm applied to a neural network architecture, based on the concepts of evaluation criteria and distinguishability relations. The algorithm has two stages: cluster selection and cluster growing. Cluster selection selects the most distinguishable d representatives (the prototypes of each cluster) among the input D data source. The cluster growing merges the remaining D-d samples in the most indistinguishable class of the d representatives. This architecture takes advantage of the self-organizing properties of neural networks with simple processing elements. Two processing elements, dilated and eroded processing elements, are defined. The structuring elements used in mathematical morphology are interpreted as weights associated with each input. The back-propagation networks continuously transmit back the output data to update the intermediate layers. This technique, in which the optimal clusters are automatically generated, can be useful for automated pattern recognition.