A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Factor Graphs and Inference

Graduate Depth 98 in the knowledge graph ☐ I know this ☆ Set as goal
2topics build on this
598prerequisites beneath it
See this on the map →
Probabilistic Graphical ModelsBayesian Networks and Inference+1 more→→Belief Propagation Algorithm
graphical-models inference factorization bipartite-graphs

Core Idea

Factor graphs decompose joint distributions into factors (functions over subsets of variables), creating a bipartite graph with variable and factor nodes. This representation unifies Bayesian networks and Markov random fields and makes inference algorithms like sum-product and max-product rules more explicit and modular.

Explainer

From your study of probabilistic graphical models and Bayesian networks, you know that a joint probability distribution over many variables can be factored into smaller, more manageable pieces. A Bayesian network expresses this factorization through conditional probability tables attached to a directed acyclic graph, while a Markov random field uses potential functions on an undirected graph. A factor graph is a more explicit representation that makes the factorization structure itself the primary object. It is a bipartite graph with two types of nodes: variable nodes (circles, representing random variables) and factor nodes (squares, representing functions over subsets of variables). An edge connects a variable node to a factor node if and only if that variable appears in that factor's function.

The advantage of factor graphs over Bayesian networks or Markov random fields is that they make the factorization completely unambiguous. In an undirected graphical model, a clique in the graph might correspond to one factor or to a product of several factors — the graph alone doesn't tell you. A factor graph resolves this ambiguity by giving each factor its own explicit node. For example, if P(a, b, c) = f₁(a, b) × f₂(b, c) × f₃(a, c), the factor graph has three variable nodes (a, b, c) and three factor nodes (f₁, f₂, f₃), with edges showing exactly which variables each factor depends on. Both Bayesian networks and Markov random fields can be converted into factor graphs, making factor graphs a universal representation for graphical models.

The real payoff of factor graphs is that they provide a clean substrate for inference algorithms. The sum-product algorithm (also called belief propagation) computes marginal distributions by passing messages between variable and factor nodes along the edges of the graph. Each message is a function (or vector) summarizing what one part of the graph "believes" about a variable. Variable-to-factor messages collect incoming information from all other factors connected to that variable; factor-to-variable messages marginalize the factor function over all other variables, weighted by incoming messages. On tree-structured factor graphs, this message passing converges in a single pass (forward then backward) and gives exact marginals. The max-product algorithm works identically but replaces summation with maximization, finding the most probable configuration instead of marginals.

When the factor graph has loops (cycles), exact inference via message passing is no longer guaranteed to converge or be correct, but loopy belief propagation — running the same message-passing rules iteratively until convergence — often works remarkably well in practice and is the backbone of applications from error-correcting codes (like LDPC and turbo codes) to computer vision. The modularity of factor graphs also makes them natural for building complex models incrementally: you can add new variables and factors without restructuring the entire model. This composability is why factor graphs are the preferred representation in many modern probabilistic programming frameworks and signal processing systems.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Indefinite Integrals → Basic Integration Rules → Riemann Sums → Definite Integral Definition → Probability Density Functions and Continuous Distributions → Cumulative Distribution Functions → Continuous Random Variables → Probability Density Functions → Expected Value → Weak Law of Large Numbers → Probability Axioms and Rules → Conditional Probability → Law of Total Probability → Bayes' Theorem and Statistical Inference → Bayesian Networks and Inference → Probabilistic Graphical Models → Markov Random Fields → Factor Graphs and Inference

Longest path: 99 steps · 598 total prerequisite topics

Prerequisites (3)

Leads To (1)