← Documentation
ADS-IDAC Engine 5.0.0
bncore::JunctionTree Class Reference

Cliques and separators compiled from one Graph. More...

#include <junction_tree.hpp>

Collaboration diagram for bncore::JunctionTree:
[legend]

Public Member Functions

 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. More...
 
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. More...
 
const Graph * graph () const
 The graph given at construction. More...
 
const std::vector< Clique > & cliques () const
 All cliques, indexed by Clique::id. More...
 
const std::vector< Separator > & separators () const
 All separators, in the order they were added. More...
 
std::vector< Clique > & get_mutable_cliques ()
 Writable access to the cliques, used by the compiler to fill potentials and CPT assignments. More...
 

Private Attributes

const Graph * graph_
 not owned More...
 
std::vector< Clique > cliques_
 
std::vector< Separator > separators_
 

Detailed Description

Cliques and separators compiled from one Graph.

The tree stores a pointer to its graph and does not own it. The graph must outlive the tree and every BatchWorkspace or BatchExecutionEngine built on it, because the workspaces read variable metadata and CPTs through this pointer. When the graph has unconnected parts, the structure is a forest with one tree per part.

Definition at line 49 of file junction_tree.hpp.

Constructor & Destructor Documentation

◆ JunctionTree()

bncore::JunctionTree::JunctionTree ( const Graph *  graph)
explicit
Parameters
graphGraph the tree describes. Not owned, must stay valid.

Definition at line 5 of file junction_tree.cpp.

Member Function Documentation

◆ add_clique()

void bncore::JunctionTree::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.

Parameters
scopeVariables of the clique.
state_sizesState count of each scope variable, in scope order.
Exceptions
std::invalid_argumentif the two lists cannot form a Factor (see the Factor constructor).

Definition at line 7 of file junction_tree.cpp.

References cliques_.

◆ add_separator()

void bncore::JunctionTree::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.

Parameters
c1Index of an existing clique. It is not checked.
c2Index of another existing clique. It is not checked.
scopeVariables shared by the two cliques.

Definition at line 13 of file junction_tree.cpp.

References cliques_, and separators_.

◆ cliques()

const std::vector< Clique > & bncore::JunctionTree::cliques ( ) const
inline

◆ get_mutable_cliques()

std::vector< Clique > & bncore::JunctionTree::get_mutable_cliques ( )
inline

Writable access to the cliques, used by the compiler to fill potentials and CPT assignments.

Definition at line 80 of file junction_tree.hpp.

References cliques_.

◆ graph()

◆ separators()

const std::vector< Separator > & bncore::JunctionTree::separators ( ) const
inline

All separators, in the order they were added.

Definition at line 74 of file junction_tree.hpp.

References separators_.

Member Data Documentation

◆ cliques_

std::vector<Clique> bncore::JunctionTree::cliques_
private

Definition at line 84 of file junction_tree.hpp.

Referenced by add_clique(), add_separator(), cliques(), and get_mutable_cliques().

◆ graph_

const Graph* bncore::JunctionTree::graph_
private

not owned

Definition at line 83 of file junction_tree.hpp.

Referenced by graph().

◆ separators_

std::vector<Separator> bncore::JunctionTree::separators_
private

Definition at line 85 of file junction_tree.hpp.

Referenced by add_separator(), and separators().


The documentation for this class was generated from the following files: