Papers
Topics
Authors
Recent
Search
2000 character limit reached

Bayesian Networks, Markov Networks, Moralisation, Triangulation: a Categorical Perspective

Published 10 Dec 2025 in cs.AI, cs.LO, and math.CT | (2512.09908v1)

Abstract: Moralisation and Triangulation are transformations allowing to switch between different ways of factoring a probability distribution into a graphical model. Moralisation allows to view a Bayesian network (a directed model) as a Markov network (an undirected model), whereas triangulation addresses the opposite direction. We present a categorical framework where these transformations are modelled as functors between a category of Bayesian networks and one of Markov networks. The two kinds of network (the objects of these categories) are themselves represented as functors from a syntax' domain to asemantics' codomain. Notably, moralisation and triangulation can be defined inductively on such syntax via functor pre-composition. Moreover, while moralisation is fully syntactic, triangulation relies on semantics. This leads to a discussion of the variable elimination algorithm, reinterpreted here as a functor in its own right, that splits the triangulation procedure in two: one purely syntactic, the other purely semantic. This approach introduces a functorial perspective into the theory of probabilistic graphical models, which highlights the distinctions between syntactic and semantic modifications.

Summary

  • The paper introduces a categorical perspective on probabilistic graphical models by using functorial semantics to unify Bayesian and Markov networks.
  • The paper formalizes moralisation and triangulation as functor precompositions that clearly separate syntactic graph transformations from semantic probabilistic content.
  • The paper connects categorical model equivalence with variable elimination and inference algorithms, paving the way for modular and extensible probabilistic reasoning.

Categorical Semantics for Bayesian Networks, Markov Networks, Moralisation, and Triangulation

Introduction and Motivation

This paper presents a categorical approach to probabilistic graphical models (PGMs), providing functorial semantics for Bayesian networks and Markov networks, and formalizing the transformations of moralisation and triangulation within a unified categorical framework (2512.09908). By leveraging category theory—specifically the structures of copy-delete (CD) categories and hypergraph categories—the work achieves principled distinctions between syntactic and semantic aspects of graphical models and their interconversion. The approach reinterprets the combinatorial transformations underlying inference algorithms (e.g., junction tree and variable elimination) as functorial constructions, allowing generalization and modularization that are not possible using standard graph-theoretic techniques.

Categorical Structures: CD-Categories and Hypergraph Categories

Bayesian networks, founded on directed acyclic graphs (DAGs), are modeled as functors from a syntactic category freely generated by a DAG (using the CD category structure) to a semantic category such as FinStochFinStoch, which encodes finite sets and stochastic matrices. CD-categories endow each object with copy and discard morphisms (commutative comonoid structure), essential for modeling variable sharing and marginalization in Bayesian networks.

Conversely, Markov networks, based on undirected graphs, are modeled as hypergraph categories. Such categories extend CD-categories with compare and omni (commutative monoid) morphisms, plus Frobenius laws expressing the interaction of duplication and comparison. This enables explicit representation of all dependencies among variables, generalizing standard factor graphs.

Notably, both Bayesian and Markov networks are functorially defined: the syntax (graph) specifies objects and generating morphisms, while the semantics (probabilistic interpretation) is carried by target functors preserving the relevant categorical structures.

Functorial Perspective on Probabilistic Graphical Models

Bayesian networks over DAG GG are in bijective correspondence with CD-functors FreeCD(G)FinStochFreeCD(G) \to FinStoch. Markov networks over undirected graph HH correspond bijectively to hypergraph functors FreeHyp(H)MatFreeHyp(H) \to Mat. This functorial semantics enables rigorous separation between combinatorial data (syntax) and probabilistic content (semantics), which is not enforced by classical approaches. Strong functoriality properties are established for both syntactic categories: their constructions are functorial over the category of graphs and graph homomorphisms, ensuring modularity.

An “irredundant” formulation is introduced to eliminate syntactic artifacts that do not affect the conditional independence structure. Irredundant networks are characterized as diagrams of functors and factorization conditions, further streamlining the analysis of equivalence and the representation of independence.

Moralisation and Triangulation via Functor Precomposition

Moralisation and triangulation, the canonical transformations to switch between directed and undirected graphical models, are realized as functor precomposition by categorical functors defined on syntax generators. Specifically:

  • Moralisation: Transforms a Bayesian network into a Markov network by adding undirected edges between all pairs of parents of each node (so-called “moral edges”). In categorical terms, a functor between the syntactic categories is defined inductively on generators, and the transformation on semantic functors is achieved by precomposition.
  • Triangulation: Converts a Markov network (undirected) into a Bayesian network (directed chordal graph), necessary for inference. The paper elucidates that triangulation naturally splits into two functors—one syntactic and one semantic—reflecting the separation of graph structure modification and the variable elimination procedure. The syntactic part is fully combinatorial; semantic modification is required for proper normalization and factoring the probabilistic content.

Notably, only triangulation requires semantic information, while moralisation is purely syntactic. This categorical distinction exposes the theoretical roots of limitations and information loss arising during model transformations.

Implications for Probabilistic Inference Algorithms

A categorical reformulation of the variable elimination algorithm is developed, proving that variable elimination corresponds to functorial factorization in hypergraph categories with conditionals. The results yield a functor VEVE{-} mapping chordal networks to Bayesian networks, which acts as the identity on objects and morphisms but changes the categorical context. The framework connects the functorial structure to the computational properties and constraints of standard inference techniques.

The categorical approach cleanly separates modular syntactic rewrites (graph structure) from semantic operations (probability distributions), providing theoretical clarity for algorithms such as junction tree and message passing, and offering prospects for categorical semantics of probabilistic programming and statistical inference.

Interactions and Idempotence of Transformations

A comprehensive commutative diagram organizes the relationships among the categories of Bayesian, Markov, and chordal networks, together with the functors for moralisation, triangulation, and variable elimination. Only semantic transformations (marked in red) require additional assumptions. The paper proves that certain compositions of these functors are idempotent (e.g., triangulating the moralised network recovers the original chordal structure), but that no adjunction exists (the transformations cannot be inverted without loss of independence information). This formalizes classical intuitions about the incompleteness of such conversions and their impact on model expressivity.

Theoretical and Practical Implications, Speculation on Future Work

The categorical framework presents multiple practical and theoretical advantages:

  • Rigorous Model Equivalence: By organizing PGMs as functors and exploiting idempotence and commutativity, the framework supports automatic proofs of model equivalence and independence preservation.
  • Modular Algorithm Design: Syntactic and semantic modularity facilitates compositional reasoning, paving the way for formal analysis of complex inference schemes, probabilistic programming semantics, and potentially even quantum generalizations.
  • Extensibility: The functorial semantics offers routes to generalize to other graphical models (Gaussian networks, factor graphs, hidden Markov models), unifying disparate techniques.
  • Foundations for Algebraic Reasoning: Abstraction of inference algorithms using string diagrams and functorial constructions opens possibilities for algebraic optimization and categorical programming environments for probabilistic reasoning.

Future developments may include a full categorical treatment of the junction tree algorithm and algebraic message passing, extension to partial DAGs or non-discrete models, and refinement of categorical tests for independence and causality, further bridging the gap between categorical probability theory and statistical machine learning.

Conclusion

This work presents a principled categorical formalization of PGMs and the canonical transformations between Bayesian and Markov networks. The separation of syntax and semantics, the functorial interpretation of moralisation and triangulation, and the categorical counterparts of inference algorithms collectively establish a modular, extensible, and semantically rigorous foundation for graphical probabilistic reasoning (2512.09908). This perspective opens the field to new forms of compositional analysis, algorithmic generalization, and integration with advanced categorical and algebraic techniques for statistical and causal modeling.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We found no open problems mentioned in this paper.

Authors (2)

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 2 tweets with 42 likes about this paper.