aGrUM  0.16.0
incrementalTriangulation.h
Go to the documentation of this file.
1 
29 #ifndef GUM_INCREMENTAL_TRIANGULATION_H
30 #define GUM_INCREMENTAL_TRIANGULATION_H
31 
32 #include <iostream>
33 #include <sstream>
34 #include <vector>
35 
39 
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 namespace gum_tests {
42  class IncrementalTriangulationTestSuite;
43 }
44 #endif
45 
46 namespace gum {
47 
52  public:
53  // ############################################################################
55  // ############################################################################
57 
59 
64  const UndiGraph* theGraph,
65  const NodeProperty< Size >* modal);
66 
69 
72 
75 
77 
78 
79  // ############################################################################
81  // ############################################################################
83 
85  void updateTriangulation();
86 
88  void addNode(const NodeId node, Size modal);
89 
92  void eraseNode(const NodeId node);
93 
96  void addEdge(const NodeId X, const NodeId Y);
97 
100  void eraseEdge(const Edge& edge);
101 
103  const EdgeSet& fillIns() {
104  GUM_ERROR(OperationNotAllowed, "Not implemented yet");
105  };
106 
108 
110  const std::vector< NodeId >& eliminationOrder();
111 
114  Idx eliminationOrder(const NodeId);
115 
118  GUM_ERROR(OperationNotAllowed, "Not implemented yet");
119  };
120 
122  const UndiGraph& graph() const;
123 
126  GUM_ERROR(OperationNotAllowed, "Not implemented yet");
127  };
128 
130  const CliqueGraph& junctionTree();
131 
134  NodeId createdJunctionTreeClique(const NodeId id);
135 
138  const NodeProperty< NodeId >& createdJunctionTreeCliques();
139 
141  const CliqueGraph& maxPrimeSubgraphTree();
142 
145  NodeId createdMaxPrimeSubgraph(const NodeId id);
146 
148  void clear();
149 
151  void setGraph(const UndiGraph* theGraph,
152  const NodeProperty< Size >* domain_sizes);
153 
155  const UnconstrainedTriangulation& triangulationAlgo() const;
156 
158 
159 
160  // ############################################################################
162  // ############################################################################
164 
166  IncrementalTriangulation& operator=(const IncrementalTriangulation& from);
167 
169  virtual IncrementalTriangulation* newFactory() const final;
170 
172  virtual IncrementalTriangulation* copyFactory() const final;
173 
175 
176 
177  private:
180 
183 
186 
189 
192 
195 
198 
201 
204 
206  bool __require_update{false};
207 
209  bool __require_elimination_order{false};
210 
212  std::vector< NodeId > __elimination_order;
213 
216 
218  bool __require_created_JT_cliques{false};
219 
222 
224  void __markAffectedMPSsByRemoveLink(const NodeId My,
225  const NodeId Mz,
226  const Edge& edge);
227 
229  int __markAffectedMPSsByAddLink(const NodeId My,
230  const NodeId Mz,
231  const NodeId X,
232  const NodeId Y);
233 
235  void __performRemoveNode(const NodeId node, const NodeId My, const NodeId Mz);
236 
238  void __performAddNode(const NodeId node);
239 
241  void __setUpConnectedTriangulation(
242  NodeId Mx,
243  NodeId Mfrom,
244  UndiGraph& theGraph,
245  std::vector< Edge >& notAffectedneighborClique,
246  HashTable< NodeId, bool >& cliques_affected);
247 
249  void __computeMaxPrimeMergings(
250  const NodeId node,
251  const NodeId from,
252  std::vector< std::pair< NodeId, NodeId > >& merged_cliques,
253  NodeProperty< bool >& mark,
254  const NodeSet& new_nodes_in_junction_tree) const;
255 
257  void __updateJunctionTree(NodeProperty< bool >& all_cliques_affected,
258  NodeSet& new_nodes_in_junction_tree);
259 
261  void __updateMaxPrimeSubgraph(NodeProperty< bool >& cliques_affected,
262  const NodeSet& new_nodes_in_junction_tree);
263 
265  void __collectEliminationOrder(const NodeId node,
266  const NodeId from,
267  NodeProperty< bool >& examined,
268  Idx& index);
269 
271  void __collectJTCliques(const NodeId clique,
272  const NodeId from,
273  NodeProperty< bool >& examined);
274 
276  bool __check();
277 
279  friend class gum_tests::IncrementalTriangulationTestSuite;
280  };
281 
282 } /* namespace gum */
283 
284 #ifndef GUM_NO_INLINE
286 #endif // GUM_NO_INLINE
287 
288 #endif /* GUM_INCREMENTAL_TRIANGULATION_H */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeProperty< std::vector< NodeId > > __cliques_of_mps
indicate for each MPS its set of cliques in the junction tree
const CliqueGraph & eliminationTree()
returns the elimination tree of a compatible ordering
CliqueGraph __T_mpd
the maximal prime subgraph tree
std::vector< NodeId > __elimination_order
the current elimination ordering
Interface for all triangulation methods without constraints on node elimination orderings.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
NodeProperty< Size > __domain_sizes
the domain sizes of the nodes
UnconstrainedTriangulation * __triangulation
the triangulation algorithm that will be used incremantally
The class for generic Hash Tables.
Definition: hashTable.h:679
Class that performs incremental triangulations.
NodeProperty< NodeId > __mps_of_clique
indicate for each clique the MPS it belongs to
const UndiGraph & triangulatedGraph()
returns the triangulated graph
Basic graph of cliques.
Definition: cliqueGraph.h:58
The base class for all undirected edges.
CliqueGraph __junction_tree
the junction tree computed so far
Base class for undirected graphs.
Definition: undiGraph.h:109
Size Idx
Type for indexes.
Definition: types.h:53
NodeProperty< NodeId > __created_JT_cliques
For each node, a clique that contains it.
const EdgeSet & fillIns()
returns the fill-ins added by the triangulation algorithm
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
UndiGraph __graph
the graph that needs be triangulated
NodeProperty< List< NodeId > > __mps_of_node
for each node in graph, store the MPS containing the node
NodeProperty< Idx > __reverse_elimination_order
the elimination order (access by NodeId)
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.
Size NodeId
Type for node ids.
Definition: graphElements.h:98
NodeProperty< bool > __mps_affected
the set of MPS affected by a new triangulation
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.