Only use algorithms from libdai
slight change in API: give pairwise potentials separately for each edge.