Measuring the stability of scientific collaboration