Searching for the M Best Solutions in Graphical Models