aGrUM  0.16.0
staticTriangulation.h
Go to the documentation of this file.
1 
28 #ifndef GUM_STATIC_TRIANGULATION_H
29 #define GUM_STATIC_TRIANGULATION_H
30 
31 #include <vector>
32 
33 #include <agrum/agrum.h>
34 
39 
40 
41 namespace gum {
42 
43 
51  public:
52  // ############################################################################
54  // ############################################################################
56 
63  virtual StaticTriangulation* newFactory() const = 0;
64 
66 
69  virtual StaticTriangulation* copyFactory() const = 0;
70 
72  virtual ~StaticTriangulation();
73 
75 
76 
77  // ############################################################################
79  // ############################################################################
81 
83 
91  virtual void setGraph(const UndiGraph* graph,
92  const NodeProperty< Size >* domsizes);
93 
95  const EdgeSet& fillIns();
96 
98  const std::vector< NodeId >& eliminationOrder();
99 
102  Idx eliminationOrder(const NodeId);
103 
107 
109  const UndiGraph& triangulatedGraph();
110 
112  const CliqueGraph& eliminationTree();
113 
115  const CliqueGraph& junctionTree();
116 
120 
124 
126 
133 
137 
139  void clear();
140 
142  void setMinimalRequirement(bool);
143 
145  virtual bool isMinimalityRequired() const final;
146 
149  void setFillIns(bool);
150 
152 
154  const UndiGraph* originalGraph() const;
155 
158 
161 
163 
164 
165  protected:
166  // ############################################################################
168  // ############################################################################
170 
172 
178  const JunctionTreeStrategy& JTStrategy,
179  bool minimality = false);
180 
182 
195  StaticTriangulation(const UndiGraph* graph,
196  const NodeProperty< Size >* dom_sizes,
197  const EliminationSequenceStrategy& elimSeq,
198  const JunctionTreeStrategy& JTStrategy,
199  bool minimality = false);
200 
203 
206 
208 
209 
210  // ############################################################################
212  // ############################################################################
214 
216 
225  virtual void _initTriangulation(UndiGraph& graph);
226 
228 
229 
232 
235 
236 
237  private:
239  const UndiGraph* __original_graph{nullptr};
240 
243 
246 
248  std::vector< NodeId > __elim_order;
249 
252 
255 
258 
260 
263  const CliqueGraph* __junction_tree{nullptr};
264 
267 
271 
273  bool __has_triangulation{false};
274 
277 
280 
282  bool __has_junction_tree{false};
283 
287 
289  bool __has_fill_ins{false};
290 
293 
296  std::vector< EdgeSet > __added_fill_ins;
297 
300  bool __we_want_fill_ins{false};
301 
302  // ===========================================================================
303 
305  void __triangulate();
306 
309 
312 
316 
318  void __computeMaxPrimeMergings(const NodeId node,
319  const NodeId from,
320  std::vector< Arc >& merged_cliques,
321  NodeSet& mark) const;
322 
325  };
326 
327 } /* namespace gum */
328 
329 #ifndef GUM_NO_INLINE
331 #endif // GUM_NO_INLINE
332 
333 #endif /* GUM_STATIC_TRIANGULATION_H */
const CliqueGraph & junctionTree()
returns a compatible junction tree
const UndiGraph & triangulatedGraph()
returns the triangulated graph
const UndiGraph * originalGraph() const
returns the graph to be triangulated
void clear()
reinitialize the graph to be triangulated to an empty graph
void setMinimalRequirement(bool)
sets/unset the minimality requirement
virtual bool isMinimalityRequired() const final
indicates wether minimality is required
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 (...
void __triangulate()
the function that performs the triangulation
bool __has_max_prime_junction_tree
indicates whether a maximal prime subgraph junction tree has been constructed
virtual ~StaticTriangulation()
destructor
EliminationSequenceStrategy * _elimination_sequence_strategy
the elimination sequence strategy used by the triangulation
const UndiGraph * __original_graph
a pointer to the (external) original graph (which will be triangulated)
virtual void _initTriangulation(UndiGraph &graph)
the function called to initialize the triangulation process
const EdgeSet & fillIns()
returns the fill-ins added by the triangulation algorithm
void __computeMaxPrimeJunctionTree()
computes the junction tree of the maximal prime subgraphs
bool __has_triangulated_graph
a boolean indicating whether we have constructed the triangulated graph
JunctionTreeStrategy * _junction_tree_strategy
the junction tree strategy used by the triangulation
UndiGraph __triangulated_graph
the triangulated graph
NodeId createdMaxPrimeSubgraph(const NodeId id)
returns the Id of the maximal prime subgraph created by the elimination of a given node during the tr...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
NodeProperty< NodeId > __reverse_elim_order
the elimination order (access by NodeId)
std::vector< EdgeSet > __added_fill_ins
a vector containing the set of fill-ins added after each node elimination (used by recursive thinning...
The class for generic Hash Tables.
Definition: hashTable.h:679
JunctionTreeStrategy & junctionTreeStrategy() const
returns the junction tree strategy used by the triangulation
bool __has_triangulation
a boolean indicating whether we have parformed a triangulation
const CliqueGraph & eliminationTree()
returns the elimination tree of a compatible ordering
bool __has_junction_tree
a boolean indicating whether the junction tree has been constructed
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setFillIns(bool)
sets/unsets the record of the fill-ins in the standard triangulation procedure
const NodeProperty< NodeId > & reverseEliminationOrder()
returns a table indicating, for each node, at which step it was deleted by the triangulation process ...
CliqueGraph __max_prime_junction_tree
the maximal prime subgraph junction tree computed from the junction tree
const std::vector< NodeId > & eliminationOrder()
returns an elimination ordering compatible with the triangulated graph
Base Class for all the algorithms producing a junction given a set of cliques/subcliques resulting fr...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeProperty< NodeSet > __elim_cliques
the cliques formed by the elimination of the nodes
Basic graph of cliques.
Definition: cliqueGraph.h:58
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual StaticTriangulation * copyFactory() const =0
virtual copy constructor
virtual StaticTriangulation * newFactory() const =0
returns a fresh triangulation of the same type as the current object but over an empty graph ...
EliminationSequenceStrategy & eliminationSequenceStrategy() const
returns the elimination sequence strategy used by the triangulation
const NodeProperty< NodeId > & createdJunctionTreeCliques()
returns the Ids of the cliques of the junction tree created by the elimination of the nodes ...
The base class for all elimination sequence algorithms used by triangulation algorithms.
bool __we_want_fill_ins
a boolean indicating if we want fill-ins list with the standard triangulation method ...
bool __has_fill_ins
indicates whether we actually computed fill-ins
bool __minimality_required
indicates whether the triangulation must be minimal
base class for all non-incremental triangulation methods
const CliqueGraph * __junction_tree
the junction tree computed by the algorithm
void __computeEliminationTree()
returns an elimination tree from a triangulated graph
Base class for undirected graphs.
Definition: undiGraph.h:109
Size Idx
Type for indexes.
Definition: types.h:53
bool __has_elimination_tree
a boolean indicating whether the elimination tree has been computed
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes)
initialize the triangulation data structures for a new graph
void __computeMaxPrimeMergings(const NodeId node, const NodeId from, std::vector< Arc > &merged_cliques, NodeSet &mark) const
used for computing the junction tree of the maximal prime subgraphs
EdgeSet __fill_ins
the fill-ins added during the whole triangulation process
Interface for all the triangulation methods.
Definition: triangulation.h:47
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __computeRecursiveThinning()
removes redondant fill-ins and compute proper elimination cliques and order
StaticTriangulation & operator=(const StaticTriangulation &)
forbid copy operator
std::vector< NodeId > __elim_order
the order in which nodes are eliminated by the algorithm
const CliqueGraph & maxPrimeSubgraphTree()
returns a junction tree of maximal prime subgraphs
Size NodeId
Type for node ids.
Definition: graphElements.h:98
NodeId createdJunctionTreeClique(const NodeId id)
returns the Id of the clique of the junction tree created by the elimination of a given node during t...
CliqueGraph __elim_tree
the elimination tree computed by the algorithm
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.