Privacy-Preserving Belief Propagation and Sampling