  While worldwide census data provide statistical evidence that firmly link the
population density with several indicators of social welfare, the precise
mechanisms underlying these observations are largely unknown. Here we study the
impact of population density on the evolution of public cooperation in
structured populations and find that the optimal density is uniquely related to
the percolation threshold of the host graph irrespective of its topological
details. We explain our observations by showing that spatial reciprocity peaks
in the vicinity of the percolation threshold, when the emergence of a giant
cooperative cluster is hindered neither by vacancy nor by invading defectors,
thus discovering an intuitive yet universal law that links the population
density with social prosperity.
