Generalization of graph network inferences in higher-order probabilistic graphical models