Efficient state estimation via inference on a probabilistic graphical model