Skip to main content

Tree query

A Tree query determines the resources required to calculate queries on a Bayesian network or dynamic Bayesian network given the current evidence scenario.


A Tree query is generally used to evaluate the complexity of exact inference for particular queries and evidence. Approximate inference may not require the same resources as exact inference, however a Tree query can still provide useful information about the complexity of the query being performed.

Many exact inference algorithms implicitly or explicitly convert a Bayesian network or dynamic Bayesian network into a tree structure in order to perform inference (calculate queries). Some algorithms explicitly build a tree called a junction tree or a join tree, while others such as Variable Elimination are implicitly performing calculations on a tree.

A Tree query allows us to determine how complex this tree is in terms of a measure called Tree width. Tree width tells us how big the largest computational unit is within the tree being used to calculate queries.


The results of a Tree query will vary depending on which nodes you are currently querying and the current evidence set. This is because algorithms can often perform optimizations when a subset of nodes are queried, and evidence often reduces the complexity of queries.