{
Variable[] vars = new Variable[] { new Variable (3), new Variable (3), new Variable (3) };
Variable[] vars1 = new Variable[]{ vars[0], vars[1] };
double[] vals1 = new double[] { 0, 0.2, 0.8, 0, 0.7, 0.3, 0, 0.5, 0.5 };
Factor tbl1 = new TableFactor (vars1, vals1);
Variable[] vars2 = new Variable[]{ vars[1], vars[2] };
double[] vals2 = new double[] { 0.2, 0.2, 0.8, 0.7, 0, 0.7, 0.3, 0, 0.5 };
Factor tbl2 = new TableFactor (vars2, vals2);
FactorGraph fg = new FactorGraph ();
fg.multiplyBy (tbl1);
fg.multiplyBy (tbl2);
System.out.println (fg.dumpToString ());