aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
gum::UnconstrainedTriangulation Class Referenceabstract

Interface for all triangulation methods without constraints on node elimination orderings. More...

#include <unconstrainedTriangulation.h>

+ Inheritance diagram for gum::UnconstrainedTriangulation:
+ Collaboration diagram for gum::UnconstrainedTriangulation:

Public Member Functions

Accessors / Modifiers
virtual UnconstrainedTriangulationnewFactory () const =0
 returns a fresh triangulation (over an empty graph) of the same type as the current object More...
 
virtual UnconstrainedTriangulationcopyFactory () const =0
 virtual copy constructor More...
 
virtual ~UnconstrainedTriangulation ()
 destructor More...
 
Accessors / Modifiers
double maxLog10CliqueDomainSize ()
 returns the max of log10DomainSize of the cliques in the junction tree. More...
 
const NodeProperty< Size > * domainSizes () const
 returns the domain sizes of the variables of the graph to be triangulated More...
 

Protected Attributes

EliminationSequenceStrategyelimination_sequence_strategy_ {nullptr}
 the elimination sequence strategy used by the triangulation More...
 
JunctionTreeStrategyjunction_tree_strategy_ {nullptr}
 the junction tree strategy used by the triangulation More...
 
const NodeProperty< Size > * domain_sizes_ {nullptr}
 the domain sizes of the variables/nodes of the graph More...
 

Protected Member Functions

Constructors / Destructors
 UnconstrainedTriangulation (const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
 default constructor More...
 
 UnconstrainedTriangulation (const UndiGraph *graph, const NodeProperty< Size > *dom, const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
 constructor with a given graph More...
 
 UnconstrainedTriangulation (const UnconstrainedTriangulation &)
 forbid copy constructor except in newfactory More...
 
 UnconstrainedTriangulation (UnconstrainedTriangulation &&)
 forbid move constructor except in children's constructors More...
 

Accessors / Modifiers

virtual void setGraph (const UndiGraph *graph, const NodeProperty< Size > *domsizes)
 initialize the triangulation data structures for a new graph More...
 
const EdgeSetfillIns ()
 returns the fill-ins added by the triangulation algorithm More...
 
const std::vector< NodeId > & eliminationOrder ()
 returns an elimination ordering compatible with the triangulated graph More...
 
Idx eliminationOrder (const NodeId)
 returns the index of a given node in the elimination order (0 = first node eliminated) More...
 
const NodeProperty< NodeId > & reverseEliminationOrder ()
 returns a table indicating, for each node, at which step it was deleted by the triangulation process More...
 
const UndiGraphtriangulatedGraph ()
 returns the triangulated graph More...
 
const CliqueGrapheliminationTree ()
 returns the elimination tree of a compatible ordering More...
 
const CliqueGraphjunctionTree ()
 returns a compatible junction tree More...
 
NodeId createdJunctionTreeClique (const NodeId id)
 returns the Id of the clique of the junction tree created by the elimination of a given node during the triangulation process More...
 
const NodeProperty< NodeId > & createdJunctionTreeCliques ()
 returns the Ids of the cliques of the junction tree created by the elimination of the nodes More...
 
const CliqueGraphmaxPrimeSubgraphTree ()
 returns a junction tree of maximal prime subgraphs More...
 
NodeId createdMaxPrimeSubgraph (const NodeId id)
 returns the Id of the maximal prime subgraph created by the elimination of a given node during the triangulation process More...
 
void clear ()
 reinitialize the graph to be triangulated to an empty graph More...
 
void setMinimalRequirement (bool)
 sets/unset the minimality requirement More...
 
virtual bool isMinimalityRequired () const final
 indicates wether minimality is required More...
 
void setFillIns (bool)
 sets/unsets the record of the fill-ins in the standard triangulation procedure More...
 
const UndiGraphoriginalGraph () const
 returns the graph to be triangulated More...
 
EliminationSequenceStrategyeliminationSequenceStrategy () const
 returns the elimination sequence strategy used by the triangulation More...
 
JunctionTreeStrategyjunctionTreeStrategy () const
 returns the junction tree strategy used by the triangulation More...
 
virtual void initTriangulation_ (UndiGraph &graph)
 the function called to initialize the triangulation process More...
 

Detailed Description

Interface for all triangulation methods without constraints on node elimination orderings.

Definition at line 44 of file unconstrainedTriangulation.h.

Constructor & Destructor Documentation

◆ ~UnconstrainedTriangulation()

gum::UnconstrainedTriangulation::~UnconstrainedTriangulation ( )
virtual

destructor

Definition at line 74 of file unconstrainedTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

74  {
75  // for debugging purposes
76  GUM_DESTRUCTOR(UnconstrainedTriangulation);
77  }
UnconstrainedTriangulation(const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor
+ Here is the call graph for this function:

◆ UnconstrainedTriangulation() [1/4]

gum::UnconstrainedTriangulation::UnconstrainedTriangulation ( const UnconstrainedEliminationSequenceStrategy elimSeq,
const JunctionTreeStrategy JTStrategy,
bool  minimality = false 
)
protected

default constructor

Parameters
elimSeqthe elimination sequence used to triangulate the graph
JTStrategythe junction tree strategy used to create junction trees
minimalitya Boolean indicating whether we should enforce that the triangulation is minimal w.r.t. inclusion

Definition at line 36 of file unconstrainedTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

39  :
40  StaticTriangulation(elimSeq, JTStrategy, minimality) {
41  // for debugging purposes
42  GUM_CONSTRUCTOR(UnconstrainedTriangulation);
43  }
UnconstrainedTriangulation(const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
+ Here is the call graph for this function:

◆ UnconstrainedTriangulation() [2/4]

gum::UnconstrainedTriangulation::UnconstrainedTriangulation ( const UndiGraph graph,
const NodeProperty< Size > *  dom,
const UnconstrainedEliminationSequenceStrategy elimSeq,
const JunctionTreeStrategy JTStrategy,
bool  minimality = false 
)
protected

constructor with a given graph

Parameters
graphthe graph to be triangulated, i.e., the nodes of which will be eliminated
domthe domain sizes of the nodes to be eliminated
elimSeqthe elimination sequence used to triangulate the graph
JTStrategythe junction tree strategy used to create junction trees
minimalitya Boolean indicating whether we should enforce that the triangulation is minimal w.r.t. inclusion
Warning
note that, by aGrUM's rule, the graph and the modalities are not copied but only referenced by the elimination sequence algorithm.

Definition at line 46 of file unconstrainedTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

51  :
52  StaticTriangulation(theGraph, domsizes, elimSeq, JTStrategy, minimality) {
53  // for debugging purposes
54  GUM_CONSTRUCTOR(UnconstrainedTriangulation);
55  }
UnconstrainedTriangulation(const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
+ Here is the call graph for this function:

◆ UnconstrainedTriangulation() [3/4]

gum::UnconstrainedTriangulation::UnconstrainedTriangulation ( const UnconstrainedTriangulation from)
protected

forbid copy constructor except in newfactory

copy constructor

Definition at line 58 of file unconstrainedTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

59  :
60  StaticTriangulation(from) {
61  // for debugging purposes
62  GUM_CONS_CPY(UnconstrainedTriangulation);
63  }
UnconstrainedTriangulation(const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
+ Here is the call graph for this function:

◆ UnconstrainedTriangulation() [4/4]

gum::UnconstrainedTriangulation::UnconstrainedTriangulation ( UnconstrainedTriangulation &&  from)
protected

forbid move constructor except in children's constructors

move constructor

Definition at line 66 of file unconstrainedTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

67  :
68  StaticTriangulation(std::move(from)) {
69  // for debugging purposes
70  GUM_CONS_MOV(UnconstrainedTriangulation);
71  }
UnconstrainedTriangulation(const UnconstrainedEliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

void gum::StaticTriangulation::clear ( )
virtualinherited

reinitialize the graph to be triangulated to an empty graph

Implements gum::Triangulation.

Definition at line 164 of file staticTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

164  {
165  // clear the factories
168 
169  // remove the current graphs
170  original_graph__ = nullptr;
171  junction_tree__ = nullptr;
173  elim_tree__.clear();
175  elim_cliques__.clear();
177 
178  // remove all fill-ins and orderings
179  fill_ins__.clear();
180  added_fill_ins__.clear();
181  elim_order__.clear();
182  reverse_elim_order__.clear();
183 
184  // indicates that the junction tree, the max prime tree, etc, are updated
185  has_triangulation__ = true;
187  has_elimination_tree__ = true;
188  has_junction_tree__ = true;
190  has_fill_ins__ = true;
191  }
bool has_max_prime_junction_tree__
indicates whether a maximal prime subgraph junction tree has been constructed
virtual void clear()
clears the sequence (to prepare, for instance, a new elimination sequence)
bool has_elimination_tree__
a boolean indicating whether the elimination tree has been computed
EdgeSet fill_ins__
the fill-ins added during the whole triangulation process
const CliqueGraph * junction_tree__
the junction tree computed by the algorithm
EliminationSequenceStrategy * elimination_sequence_strategy_
the elimination sequence strategy used by the triangulation
void clear() override
removes all the nodes and edges from the graph
Definition: undiGraph_inl.h:46
std::vector< NodeId > elim_order__
the order in which nodes are eliminated by the algorithm
bool has_junction_tree__
a boolean indicating whether the junction tree has been constructed
CliqueGraph max_prime_junction_tree__
the maximal prime subgraph junction tree computed from the junction tree
bool has_triangulation__
a boolean indicating whether we have parformed a triangulation
bool has_triangulated_graph__
a boolean indicating whether we have constructed the triangulated graph
CliqueGraph elim_tree__
the elimination tree computed by the algorithm
const UndiGraph * original_graph__
a pointer to the (external) original graph (which will be triangulated)
virtual void clear()
removes all the cliques and separators from the graph (as well as their adjacent edges) ...
bool has_fill_ins__
indicates whether we actually computed fill-ins
NodeProperty< NodeId > node_2_max_prime_clique__
indicates which clique of the max prime junction tree was created by the elmination of a given node (...
virtual void clear()=0
resets the current junction tree strategy data structures
NodeProperty< NodeId > reverse_elim_order__
the elimination order (access by NodeId)
NodeProperty< NodeSet > elim_cliques__
the cliques formed by the elimination of the nodes
std::vector< EdgeSet > added_fill_ins__
a vector containing the set of fill-ins added after each node elimination (used by recursive thinning...
JunctionTreeStrategy * junction_tree_strategy_
the junction tree strategy used by the triangulation
void clear()
Removes all the elements, if any, from the set.
Definition: set_tpl.h:374
UndiGraph triangulated_graph__
the triangulated graph
+ Here is the call graph for this function:

◆ copyFactory()

virtual UnconstrainedTriangulation* gum::UnconstrainedTriangulation::copyFactory ( ) const
pure virtual

virtual copy constructor

note that we return a pointer as it enables subclasses to return pointers to their types, not Triangulation pointers. See item 25 of the more effective C++.

Implements gum::StaticTriangulation.

Implemented in gum::DefaultTriangulation.

◆ createdJunctionTreeClique()

NodeId gum::StaticTriangulation::createdJunctionTreeClique ( const NodeId  id)
virtualinherited

returns the Id of the clique of the junction tree created by the elimination of a given node during the triangulation process

Implements gum::Triangulation.

◆ createdJunctionTreeCliques()

const NodeProperty< NodeId >& gum::StaticTriangulation::createdJunctionTreeCliques ( )
virtualinherited

returns the Ids of the cliques of the junction tree created by the elimination of the nodes

Implements gum::Triangulation.

◆ createdMaxPrimeSubgraph()

NodeId gum::StaticTriangulation::createdMaxPrimeSubgraph ( const NodeId  id)
virtualinherited

returns the Id of the maximal prime subgraph created by the elimination of a given node during the triangulation process

Implements gum::Triangulation.

◆ domainSizes()

const NodeProperty< Size >* gum::Triangulation::domainSizes ( ) const
inherited

returns the domain sizes of the variables of the graph to be triangulated

◆ eliminationOrder() [1/2]

const std::vector< NodeId >& gum::StaticTriangulation::eliminationOrder ( )
virtualinherited

returns an elimination ordering compatible with the triangulated graph

Implements gum::Triangulation.

◆ eliminationOrder() [2/2]

Idx gum::StaticTriangulation::eliminationOrder ( const NodeId  )
virtualinherited

returns the index of a given node in the elimination order (0 = first node eliminated)

Implements gum::Triangulation.

◆ eliminationSequenceStrategy()

EliminationSequenceStrategy& gum::StaticTriangulation::eliminationSequenceStrategy ( ) const
inherited

returns the elimination sequence strategy used by the triangulation

◆ eliminationTree()

const CliqueGraph& gum::StaticTriangulation::eliminationTree ( )
virtualinherited

returns the elimination tree of a compatible ordering

Implements gum::Triangulation.

◆ fillIns()

const EdgeSet & gum::StaticTriangulation::fillIns ( )
virtualinherited

returns the fill-ins added by the triangulation algorithm

Implements gum::Triangulation.

Definition at line 679 of file staticTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

679  {
680  // if we did not compute the triangulation yet, do it and commpute
681  // the fill-ins at the same time
682  if (!has_triangulation__) {
683  bool want_fill_ins = we_want_fill_ins__;
684  we_want_fill_ins__ = true;
685  triangulate__();
686  we_want_fill_ins__ = want_fill_ins;
687  has_fill_ins__ = true;
688  }
689 
690  // here, we already computed a triangulation and we already computed
691  // the fill-ins, so return them
692  if (has_fill_ins__) {
695  else
696  return fill_ins__;
697  } else {
698  // ok, here, we shall compute the fill-ins as they were not precomputed
699  if (!original_graph__) return fill_ins__;
700 
701  // just in case, be sure that the junction tree has been constructed
703 
704  for (const auto clik_id: junction_tree__->nodes()) {
705  // for each clique, add the edges necessary to make it complete
706  const NodeSet& clique = junction_tree__->clique(clik_id);
707  std::vector< NodeId > clique_nodes(clique.size());
708  unsigned int i = 0;
709 
710  for (const auto node: clique) {
711  clique_nodes[i] = node;
712  i += 1;
713  }
714 
715  for (i = 0; i < clique_nodes.size(); ++i) {
716  for (unsigned int j = i + 1; j < clique_nodes.size(); ++j) {
717  Edge edge(clique_nodes[i], clique_nodes[j]);
718 
719  if (!original_graph__->existsEdge(edge)) {
720  try {
721  fill_ins__.insert(edge);
722  } catch (DuplicateElement&) {}
723  }
724  }
725  }
726  }
727 
728  return fill_ins__;
729  }
730  }
const CliqueGraph & junctionTree()
returns a compatible junction tree
virtual const EdgeSet & fillIns()
in case fill-ins are provided, this function returns the fill-ins due to all the nodes eliminated so ...
EdgeSet fill_ins__
the fill-ins added during the whole triangulation process
const CliqueGraph * junction_tree__
the junction tree computed by the algorithm
EliminationSequenceStrategy * elimination_sequence_strategy_
the elimination sequence strategy used by the triangulation
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
bool has_junction_tree__
a boolean indicating whether the junction tree has been constructed
void triangulate__()
the function that performs the triangulation
bool has_triangulation__
a boolean indicating whether we have parformed a triangulation
const UndiGraph * original_graph__
a pointer to the (external) original graph (which will be triangulated)
bool has_fill_ins__
indicates whether we actually computed fill-ins
bool we_want_fill_ins__
a boolean indicating if we want fill-ins list with the standard triangulation method ...
bool existsEdge(const Edge &edge) const
indicates whether a given edge exists
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
const NodeSet & clique(const NodeId idClique) const
returns the set of nodes included into a given clique
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:632
virtual bool providesFillIns() const =0
indicates whether the fill-ins generated by the eliminated nodes, if needed, will be computed by the ...
+ Here is the call graph for this function:

◆ initTriangulation_()

void gum::StaticTriangulation::initTriangulation_ ( UndiGraph graph)
protectedvirtualinherited

the function called to initialize the triangulation process

This function is called when the triangulation process starts and is used to initialize the elimination sequence strategy. Actually, the graph that is modified by the triangulation algorithm is a copy of the original graph, and this copy needs be known by the elimination sequence strategy. initTriangulation_ is used to transmit this knowledge to the elimination sequence (through method setGraph of the elimination sequence class).

Parameters
graphthe very graph that is triangulated (this is a copy of original_graph__)

Reimplemented in gum::PartialOrderedTriangulation, and gum::OrderedTriangulation.

Definition at line 733 of file staticTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

733  {
735  }
EliminationSequenceStrategy * elimination_sequence_strategy_
the elimination sequence strategy used by the triangulation
const NodeProperty< Size > * domain_sizes_
the domain sizes of the variables/nodes of the graph
virtual bool setGraph(UndiGraph *graph, const NodeProperty< Size > *dom_sizes)
sets a new graph to be triangulated
+ Here is the call graph for this function:

◆ isMinimalityRequired()

virtual bool gum::StaticTriangulation::isMinimalityRequired ( ) const
finalvirtualinherited

indicates wether minimality is required

◆ junctionTree()

const CliqueGraph& gum::StaticTriangulation::junctionTree ( )
virtualinherited

returns a compatible junction tree

Implements gum::Triangulation.

◆ junctionTreeStrategy()

JunctionTreeStrategy& gum::StaticTriangulation::junctionTreeStrategy ( ) const
inherited

returns the junction tree strategy used by the triangulation

◆ maxLog10CliqueDomainSize()

double gum::Triangulation::maxLog10CliqueDomainSize ( )
inherited

returns the max of log10DomainSize of the cliques in the junction tree.

This is usefull for instance to estimate the complexity (both in space and in time) of the inference that will use the junction tree.

This method is not 'const' since it can be called before building any junction tree and hence it needs to build it...

Definition at line 69 of file triangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

69  {
70  double res = 0.0;
71  double dSize;
72  const JunctionTree& jt = junctionTree(); // here, the fact that we get
73  // a junction tree ensures that domain_sizes_ is different from nullptr
74 
75  for (const NodeId cl: jt) {
76  dSize = 0.0;
77 
78  for (const auto node: jt.clique(cl))
79  dSize += std::log10((*domain_sizes_)[node]);
80 
81  if (res < dSize) res = dSize;
82  }
83 
84  return res;
85  }
const NodeProperty< Size > * domain_sizes_
the domain sizes of the variables/nodes of the graph
CliqueGraph JunctionTree
a junction tree is a clique graph satisfying the running intersection property and such that no cliqu...
Definition: cliqueGraph.h:301
virtual const CliqueGraph & junctionTree()=0
returns a compatible junction tree
Size NodeId
Type for node ids.
Definition: graphElements.h:97
+ Here is the call graph for this function:

◆ maxPrimeSubgraphTree()

const CliqueGraph& gum::StaticTriangulation::maxPrimeSubgraphTree ( )
virtualinherited

returns a junction tree of maximal prime subgraphs

Warning
Actually, the cliques of the junction tree are guarranteed to be maximal prime subgraph of the original graph that was triangulated only if the triangulation performed is minimal (in the sense that removing any edge in the triangulated graph results in a nontriangulated graph). This can be ensured by requiring minimality of the triangulation.

Implements gum::Triangulation.

◆ newFactory()

virtual UnconstrainedTriangulation* gum::UnconstrainedTriangulation::newFactory ( ) const
pure virtual

returns a fresh triangulation (over an empty graph) of the same type as the current object

note that we return a pointer as it enables subclasses to return pointers to their types, not Triangulation pointers. See item 25 of the more effective C++.

Implements gum::StaticTriangulation.

Implemented in gum::DefaultTriangulation.

◆ operator=()

UnconstrainedTriangulation& gum::UnconstrainedTriangulation::operator= ( const UnconstrainedTriangulation )
private

forbid copy operator

◆ originalGraph()

const UndiGraph* gum::StaticTriangulation::originalGraph ( ) const
inherited

returns the graph to be triangulated

Warning
if we have not set yet a graph, then originalGraph () will return a nullptr.

◆ reverseEliminationOrder()

const NodeProperty< NodeId >& gum::StaticTriangulation::reverseEliminationOrder ( )
inherited

returns a table indicating, for each node, at which step it was deleted by the triangulation process

◆ setFillIns()

void gum::StaticTriangulation::setFillIns ( bool  )
inherited

sets/unsets the record of the fill-ins in the standard triangulation procedure

◆ setGraph()

void gum::StaticTriangulation::setGraph ( const UndiGraph graph,
const NodeProperty< Size > *  domsizes 
)
virtualinherited

initialize the triangulation data structures for a new graph

Parameters
graphthe graph to be triangulated, i.e., the nodes of which will be eliminated
domsizesthe domain sizes of the nodes to be eliminated
Warning
Note that we allow domsizes to be defined over nodes/variables that do not belong to graph. These sizes will simply be ignored. However, it is compulsory that all the nodes of graph belong to dom_sizes
the graph is not copied but only referenced by the elimination sequence algorithm.

Implements gum::Triangulation.

Reimplemented in gum::PartialOrderedTriangulation, and gum::OrderedTriangulation.

Definition at line 526 of file staticTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

527  {
528  // remove the old graph
529  clear();
530 
531  if (graph != nullptr) {
532  // prepare the size of the data for the new graph
533  elim_order__.resize(graph->size());
534  reverse_elim_order__.resize(graph->size());
535  elim_cliques__.resize(graph->size());
536  added_fill_ins__.resize(graph->size());
537  node_2_max_prime_clique__.resize(graph->size());
538  }
539 
540  // keep track of the variables passed in argument
541  original_graph__ = graph;
542  domain_sizes_ = domsizes;
543 
544  // indicate that no triangulation was performed for this graph
545  has_triangulation__ = false;
546  has_triangulated_graph__ = false;
547  has_elimination_tree__ = false;
548  has_junction_tree__ = false;
550  has_fill_ins__ = false;
551  }
bool has_max_prime_junction_tree__
indicates whether a maximal prime subgraph junction tree has been constructed
bool has_elimination_tree__
a boolean indicating whether the elimination tree has been computed
void clear()
reinitialize the graph to be triangulated to an empty graph
std::vector< NodeId > elim_order__
the order in which nodes are eliminated by the algorithm
bool has_junction_tree__
a boolean indicating whether the junction tree has been constructed
const NodeProperty< Size > * domain_sizes_
the domain sizes of the variables/nodes of the graph
bool has_triangulation__
a boolean indicating whether we have parformed a triangulation
bool has_triangulated_graph__
a boolean indicating whether we have constructed the triangulated graph
const UndiGraph * original_graph__
a pointer to the (external) original graph (which will be triangulated)
bool has_fill_ins__
indicates whether we actually computed fill-ins
NodeProperty< NodeId > node_2_max_prime_clique__
indicates which clique of the max prime junction tree was created by the elmination of a given node (...
NodeProperty< NodeId > reverse_elim_order__
the elimination order (access by NodeId)
NodeProperty< NodeSet > elim_cliques__
the cliques formed by the elimination of the nodes
std::vector< EdgeSet > added_fill_ins__
a vector containing the set of fill-ins added after each node elimination (used by recursive thinning...
+ Here is the call graph for this function:

◆ setMinimalRequirement()

void gum::StaticTriangulation::setMinimalRequirement ( bool  )
inherited

sets/unset the minimality requirement

◆ triangulatedGraph()

const UndiGraph & gum::StaticTriangulation::triangulatedGraph ( )
virtualinherited

returns the triangulated graph

Implements gum::Triangulation.

Definition at line 487 of file staticTriangulation.cpp.

References gum::Set< Key, Alloc >::emplace().

487  {
489 
490  // if we did not construct the triangulated graph during the triangulation,
491  // that is, we just constructed the junction tree, we shall construct it now
493  // just in case, be sure that the junction tree has been constructed
495 
496  // copy the original graph
498 
499  for (const auto clik_id: *junction_tree__) {
500  // for each clique, add the edges necessary to make it complete
501  const NodeSet& clique = junction_tree__->clique(clik_id);
502  std::vector< NodeId > clique_nodes(clique.size());
503  unsigned int i = 0;
504 
505  for (const auto node: clique) {
506  clique_nodes[i] = node;
507  i += 1;
508  }
509 
510  for (i = 0; i < clique_nodes.size(); ++i) {
511  for (unsigned int j = i + 1; j < clique_nodes.size(); ++j) {
512  try {
513  triangulated_graph__.addEdge(clique_nodes[i], clique_nodes[j]);
514  } catch (DuplicateElement&) {}
515  }
516  }
517  }
518 
520  }
521 
522  return triangulated_graph__;
523  }
const CliqueGraph & junctionTree()
returns a compatible junction tree
const CliqueGraph * junction_tree__
the junction tree computed by the algorithm
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
bool has_junction_tree__
a boolean indicating whether the junction tree has been constructed
void triangulate__()
the function that performs the triangulation
bool has_triangulation__
a boolean indicating whether we have parformed a triangulation
bool has_triangulated_graph__
a boolean indicating whether we have constructed the triangulated graph
const UndiGraph * original_graph__
a pointer to the (external) original graph (which will be triangulated)
UndiGraph triangulated_graph__
the triangulated graph
void addEdge(NodeId first, NodeId second) override
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:34
+ Here is the call graph for this function:

Member Data Documentation

◆ domain_sizes_

const NodeProperty< Size >* gum::Triangulation::domain_sizes_ {nullptr}
protectedinherited

the domain sizes of the variables/nodes of the graph

Definition at line 152 of file triangulation.h.

◆ elimination_sequence_strategy_

EliminationSequenceStrategy* gum::StaticTriangulation::elimination_sequence_strategy_ {nullptr}
protectedinherited

the elimination sequence strategy used by the triangulation

Definition at line 230 of file staticTriangulation.h.

◆ junction_tree_strategy_

JunctionTreeStrategy* gum::StaticTriangulation::junction_tree_strategy_ {nullptr}
protectedinherited

the junction tree strategy used by the triangulation

Definition at line 233 of file staticTriangulation.h.


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