← Documentation
ADS-IDAC Engine 5.0.0
junction_tree.cpp
Go to the documentation of this file.
2
3namespace bncore {
4
5JunctionTree::JunctionTree(const Graph *graph) : graph_(graph) {}
6
7void JunctionTree::add_clique(const std::vector<NodeId> &scope,
8 const std::vector<std::size_t> &state_sizes) {
9 cliques_.push_back(
10 {cliques_.size(), scope, {}, Factor(scope, state_sizes), {}});
11}
12
13void JunctionTree::add_separator(std::size_t c1, std::size_t c2,
14 const std::vector<NodeId> &scope) {
15 separators_.push_back({c1, c2, scope});
16 cliques_[c1].neighbor_cliques.push_back(c2);
17 cliques_[c2].neighbor_cliques.push_back(c1);
18}
19
20} // namespace bncore
A potential over an ordered scope of variables.
Definition: factor.hpp:22
Directed graphical model over discrete variables.
Definition: graph.hpp:28
JunctionTree(const Graph *graph)
void add_clique(const std::vector< NodeId > &scope, const std::vector< std::size_t > &state_sizes)
Appends a clique. Its id is the number of cliques before the call.
void add_separator(std::size_t c1, std::size_t c2, const std::vector< NodeId > &scope)
Appends a separator and records each clique as a neighbor of the other.
std::vector< Clique > cliques_
std::vector< Separator > separators_
Junction tree data structure of BNCore: Clique, Separator and the JunctionTree container.