Loopy Belief Propagation sample code