| Algorithm 4. Junction tree algorithm for BN inference |
| Step 1: Construct a junction tree based on the existing BN; |
| Step 2: Propagate messages along the junction tree using a message passing algorithm; |
| Step 3: Answer queries when evidence is introduced. |