aGrUM  0.16.0
barrenNodesFinder_tpl.h
Go to the documentation of this file.
1 
23 namespace gum {
24 
26  template < typename GUM_SCALAR >
27  ArcProperty< Set< const Potential< GUM_SCALAR >* > >
29  const IBayesNet< GUM_SCALAR >& bn) {
30  // get the barren nodes
31  ArcProperty< NodeSet > barren_nodes = this->barrenNodes(junction_tree);
32 
33  // transform the node sets into sets of potentials
35  for (const auto& barren : barren_nodes) {
37  for (const auto node : barren.second) {
38  potentials.insert(&(bn.cpt(node)));
39  }
40  result.insert(Arc(barren.first), std::move(potentials));
41  }
42 
43  return result;
44  }
45 
46 
47 } /* namespace gum */
virtual const Potential< GUM_SCALAR > & cpt(NodeId varId) const =0
Returns the CPT of a variable.
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:62
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:165
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
NodeSet barrenNodes()
returns the set of barren nodes
Basic graph of cliques.
Definition: cliqueGraph.h:58
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:613
ArcProperty< Set< const Potential< GUM_SCALAR > *> > barrenPotentials(const CliqueGraph &junction_tree, const IBayesNet< GUM_SCALAR > &bn)
returns the set of barren potentials in messages sent in a junction tree