add the weight of a diagram