Code to simulate Adaptation and Learning in Diffusion Networks