A combinatorial cost built from local terms has a Boltzmann distribution. On a tree, the partition function of that distribution is not an exponential sum: pinning a variable splits the graph into independent branches, and the branch weights satisfy a local recursion. Normalize those weights and the recursion is belief propagation.
These notes derive that update from first principles — reduced partition functions