Discrete Factor and its operations in Probabilistic Graphical Models