fixed the sum-product variant of the belief propagation

added support for the sum-product variant of the belief propagation algorithm