  The correct identification of clusters is crucial for an accurate monitoring
of the spread of a disease and also in many other natural, social and physical
phenomena which exhibit an epidemic structure. Nevertheless, even when an
accurate mathematical model is available, no simple tool exists which allows
one to identify how many independent clusters are present and to link elements
to the appropriate clusters. Here we develop an automatic method for the
detection of the internal structure of the clusters and their number,
independently of the model that describes the dynamics of the phenomenon. It is
substantially based on the difference of the log-likelihood $\delta {\cal LL}$,
that is evaluated when all elements are connected and when they are grouped
into clusters. As a function of the number of connected elements $\delta {\cal
LL}$ presents a change of slope and a singularity which can be both used in
cluster identification. Our method is validated for an epidemic model with a
minimal temporal structure and for the Epidemic Type Aftershock Sequence model
describing the spatio-temporal clustering of earthquakes.
