27 #ifndef GUM_STATIC_TRIANGULATION_H 28 #define GUM_STATIC_TRIANGULATION_H 32 #include <agrum/agrum.h> 34 #include <agrum/tools/graphs/algorithms/triangulations/eliminationStrategies/eliminationSequenceStrategy.h> 35 #include <agrum/tools/graphs/algorithms/triangulations/junctionTreeStrategies/junctionTreeStrategy.h> 36 #include <agrum/tools/graphs/algorithms/triangulations/triangulation.h> 37 #include <agrum/tools/graphs/cliqueGraph.h> 90 virtual void setGraph(
const UndiGraph* graph,
const NodeProperty< Size >* domsizes);
176 const JunctionTreeStrategy& JTStrategy,
177 bool minimality =
false);
194 const NodeProperty< Size >* dom_sizes,
195 const EliminationSequenceStrategy& elimSeq,
196 const JunctionTreeStrategy& JTStrategy,
197 bool minimality =
false);
318 std::vector< Arc >& merged_cliques,
319 NodeSet& mark)
const;
327 #ifndef GUM_NO_INLINE 328 # include <agrum/tools/graphs/algorithms/triangulations/staticTriangulation_inl.h> const CliqueGraph & junctionTree()
returns a compatible junction tree
bool _has_triangulated_graph_
a boolean indicating whether we have constructed the triangulated graph
const UndiGraph & triangulatedGraph()
returns the triangulated graph
bool _has_max_prime_junction_tree_
indicates whether a maximal prime subgraph junction tree has been constructed
const UndiGraph * originalGraph() const
returns the graph to be triangulated
CliqueGraph _elim_tree_
the elimination tree computed by the algorithm
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
StaticTriangulation(StaticTriangulation &&)
forbid move constructor except in children's constructors
void _computeMaxPrimeJunctionTree_()
computes the junction tree of the maximal prime subgraphs
EliminationSequenceStrategy * elimination_sequence_strategy_
the elimination sequence strategy used by the triangulation
CliqueGraph _max_prime_junction_tree_
the maximal prime subgraph junction tree computed from the junction tree
bool _minimality_required_
indicates whether the triangulation must be minimal
virtual ~StaticTriangulation()
destructor
INLINE void emplace(Args &&... args)
void _triangulate_()
the function that performs the triangulation
std::vector< EdgeSet > _added_fill_ins_
a vector containing the set of fill-ins added after each node elimination (used by recursive thinning...
const EdgeSet & fillIns()
returns the fill-ins added by the triangulation algorithm
StaticTriangulation(const StaticTriangulation &)
forbid copy constructor except in newfactory
bool _we_want_fill_ins_
a boolean indicating if we want fill-ins list with the standard triangulation method ...
StaticTriangulation(const UndiGraph *graph, const NodeProperty< Size > *dom_sizes, const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
constructor with a given 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...
NodeProperty< NodeId > _reverse_elim_order_
the elimination order (access by NodeId)
EdgeSet _fill_ins_
the fill-ins added during the whole triangulation process
Idx eliminationOrder(const NodeId)
returns the index of a given node in the elimination order (0 = first node eliminated) ...
JunctionTreeStrategy & junctionTreeStrategy() const
returns the junction tree strategy used by the triangulation
UndiGraph _triangulated_graph_
the triangulated graph
bool _has_junction_tree_
a boolean indicating whether the junction tree has been constructed
const CliqueGraph & eliminationTree()
returns the elimination tree of a compatible ordering
bool _has_triangulation_
a boolean indicating whether we have parformed a triangulation
bool _has_fill_ins_
indicates whether we actually computed fill-ins
NodeProperty< NodeSet > _elim_cliques_
the cliques formed by the elimination of the nodes
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 ...
const std::vector< NodeId > & eliminationOrder()
returns an elimination ordering compatible with the triangulated 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
virtual void initTriangulation_(UndiGraph &graph)
the function called to initialize the triangulation process
const CliqueGraph * _junction_tree_
the junction tree computed by the algorithm
std::vector< NodeId > _elim_order_
the order in which nodes are eliminated by the algorithm
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 ...
base class for all non-incremental triangulation methods
JunctionTreeStrategy * junction_tree_strategy_
the junction tree strategy used by the triangulation
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes)
initialize the triangulation data structures for a new graph
const UndiGraph * _original_graph_
a pointer to the (external) original graph (which will be triangulated)
StaticTriangulation & operator=(const StaticTriangulation &)
forbid copy operator
const CliqueGraph & maxPrimeSubgraphTree()
returns a junction tree of maximal prime subgraphs
bool _has_elimination_tree_
a boolean indicating whether the elimination tree has been computed
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...
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 _computeEliminationTree_()
returns an elimination tree from a triangulated graph
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
void _computeRecursiveThinning_()
removes redondant fill-ins and compute proper elimination cliques and order