ArticleslgStudy

computer science

Factor graph

Factor graph is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Factor graph rather than just read about it. In short: A factor graph is a bipartite graph representing the factorization of a function. In probability theory and its applications, factor graphs are used to represent factorization of a probability distribution function, enabling efficient computations, such as the computation of marginal distributions through the sum–product algorithm.

Factor graph — main illustration
Factor graph — illustration

Key takeaways

  • Factor graph belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Factor graph to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Factor graph from memory before moving on to harder problems.

Reference excerpt

A factor graph is a bipartite graph representing the factorization of a function. In probability theory and its applications, factor graphs are used to represent factorization of a probability distribution function, enabling efficient computations, such as the computation of marginal distributions through the sum–product algorithm. One of the important success stories of factor graphs and the sum–product algorithm is the decoding of capacity-approaching error-correcting codes, such as LDPC and turbo codes. Factor graphs generalize constraint graphs. A factor whose value is either 0 or 1 is called a constraint. A constraint graph is a factor graph where all factors are constraints. The max-product algorithm for factor graphs can be viewed as a generalization of the arc-consistency algorithm for constraint processing.

Definition A factor graph is a bipartite graph representing the factorization of a function. Given a factorization of a function g(X1,X2,…,Xn),

g(X1,X2,…,Xn)=∏j=1mfj(Sj), where Sj⊆{X1,X2,…,Xn}, the corresponding factor graph G=(X,F,E) consists of variable vertices X={X1,X2,…,Xn}, factor vertices F={f1,f2,…,fm}, and edges E. The edges depend on the factorization as follows: there is an undirected edge between factor vertex fj and variable vertex Xk if Xk∈Sj. The function is tacitly assumed to be real-valued: g(X1,X2,…,Xn)∈ℝ. Factor graphs can be combined with message passing algorithms to efficiently compute certain characteristics of the function g(X1,X2,…,Xn), such as the marginal distributions.

Examples

Consider a function that factorizes as follows:

g(X1,X2,X3)=f1(X1)f2(X1,X2)f3(X1,X2)f4(X2,X3), with a corresponding factor graph shown on the right. Observe that the factor graph has a cycle. If we merge f2(X1,X2)f3(X1,X2) into a single factor, the resulting factor graph will be a tree. This is an important distinction, as message passing algorithms are usually exact for trees, but only approximate for graphs with cycles.

Message passing on factor graphs A popular message passing algorithm on factor graphs is the sum–product algorithm, which efficiently computes all the marginals of the individual variables of the function. In particular, the marginal of variable Xk is defined as

gk(Xk)=∑Xk¯g(X1,X2,…,Xn) where the notation Xk¯ means that the summation goes over all the variables, except Xk. The messages of the sum–product algorithm are conceptually computed in the vertices and passed along the edges. A message from or to a variable vertex is always a function of that particular variable. For instance, when a variable is binary, the messages over the edges incident to the corresponding vertex can be represented as vectors of length 2: the first entry is the message evaluated in 0, the second entry is the message evaluated in 1. When a variable belongs to the field of real numbers, messages can be arbitrary functions, and special care needs to be taken in their representation. In practice, the sum–product algorithm is used for statistical inference, where g(X1,X2,…,Xn) is a joint distribution or a joint likelihood function, and the factorization depends on the conditional independencies among the variables. The Hammersley–Clifford theorem shows that other probabilistic models such as Bayesian networks and Markov networks can be represented as factor graphs; the latter representation is frequently used when performing inference over such networks using belief propagation. On the other hand, Bayesian networks are more naturally suited for generative models, as they can directly represent the causalities of the model.

See also Belief propagation Bayesian inference Bayesian programming Conditional probability Markov network Bayesian network Hammersley–Clifford theorem

References Clifford (1990), "Markov random fields in statistics", in Grimmett, G.R.; Welsh, D.J.A. (eds.), Disorder in Physical Systems, J.M. Hammersley Festschrift (postscript), Oxford University Press, pp. 19–32, ISBN 9780198532156 Frey, Brendan J. (2003), "Extending Factor Graphs so as to Unify Directed and Undirected Graphical Models", in Jain, Nitin (ed.), UAI'03, Proceedings of the 19th Conference in Uncertainty in Artificial Intelligence, Morgan Kaufmann, pp. 257–264, arXiv:1212.2486, ISBN 0127056645 Kschischang, Frank R.; Frey, Brendan J.; Loeliger, Hans-Andrea (2001), "Factor Graphs and the Sum-Product Algorithm", IEEE Transactions on Information Theory, 47 (2): 498–519, Bibcode:2001ITIT...47..498K, doi:10.1109/18.910572. Wymeersch, Henk (2007), Iterative Receiver Design, Cambridge University Press, ISBN 978-0-521-87315-4

Further reading Loeliger, Hans-Andrea (January 2004), "An Introduction to Factor Graphs]" (PDF), IEEE Signal Processing Magazine, 21 (1): 28–41, Bibcode:2004ISPM...21...28L, doi:10.1109/MSP.2004.1267047, S2CID 7722934 dimple Archived 2016-01-06 at the Wayback Machine an open-source tool for building and solving factor graphs in MATLAB. Loeliger, Hans-Andrea (2008), An introduction to Factor Graphs (PDF)

Worked examples

Example 1 — a first encounter with Factor graph

Start with the simplest possible case. Write down what Factor graph claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Factor graph before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Factor graph ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Factor graph

In research
Factor graph appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Factor graph in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Factor graph is common in secondary-school and first-year university syllabi. It links to neighbouring topics Application-specific graphs, Graphical models, Markov networks, so understanding it makes those chapters shorter.
In everyday life
Look for Factor graph outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Factor graph” →

How to study Factor graph in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Factor graph means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Factor graph out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Factor graph in simple terms?

A factor graph is a bipartite graph representing the factorization of a function. In probability theory and its applications, factor graphs are used to represent factorization of a probability distribution function, enabling efficient computations, such as the computation of marginal distributions…

Why does Factor graph matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Factor graph?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Factor graph.

Tags

  • Application-specific graphs
  • Graphical models
  • Markov networks

Keep exploring