[number of nodes] n [number of edges] m [node 1] [no of labels for node 1] [node potential values for each label] . . [node 1] [node 2] [edge potential values for each pair of label for the nodes] (2-d matrix is converted to 1-d in row major way) . . . Ex. :- An undirected graphical model with 3 nodes, 2 edges and 2 labels for each node. 3 2 0 2 0.1 1 1 2 1 0.9 2 2 1 0.7 0 1 0.8 0.2 0.2 0.8 1 2 0.8 0.2 0.2 0.8