A Graphical Transformation for Belief Propagation: Maximum Weight Matchings and Odd-Sized Cycles