Implementation of Algorithms for Inference and Learning on  Graphical Models