![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The default triangulation algorithm used by aGrUM. More...
#include <defaultTriangulation.h>
Public Member Functions | |
Constructors / Destructors | |
DefaultTriangulation (const UndiGraph *graph, const NodeProperty< Size > *dom_sizes, bool minimality=false, double theRatio=GUM_QUASI_RATIO, double theThreshold=GUM_WEIGHT_THRESHOLD) | |
basic constructor. initialize the triangulation More... | |
DefaultTriangulation (bool minimality=false, double theRatio=GUM_QUASI_RATIO, double theThreshold=GUM_WEIGHT_THRESHOLD) | |
default constructor: initialize the triangulation for an empty graph More... | |
DefaultTriangulation (const DefaultTriangulation &from) | |
copy constructor More... | |
DefaultTriangulation (DefaultTriangulation &&from) | |
move constructor More... | |
~DefaultTriangulation () | |
destructor More... | |
virtual DefaultTriangulation * | newFactory () const |
virtual clone constructor More... | |
virtual DefaultTriangulation * | copyFactory () const |
virtual copy constructor 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 | |
EliminationSequenceStrategy * | elimination_sequence_strategy_ {nullptr} |
the elimination sequence strategy used by the triangulation More... | |
JunctionTreeStrategy * | junction_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... | |
Accessors / Modifiers | |
virtual void | setGraph (const UndiGraph *graph, const NodeProperty< Size > *domsizes) |
initialize the triangulation data structures for a new graph More... | |
const EdgeSet & | fillIns () |
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 UndiGraph & | triangulatedGraph () |
returns the triangulated graph More... | |
const CliqueGraph & | eliminationTree () |
returns the elimination tree of a compatible ordering More... | |
const CliqueGraph & | junctionTree () |
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 CliqueGraph & | maxPrimeSubgraphTree () |
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 UndiGraph * | originalGraph () const |
returns the graph to be triangulated More... | |
EliminationSequenceStrategy & | eliminationSequenceStrategy () const |
returns the elimination sequence strategy used by the triangulation More... | |
JunctionTreeStrategy & | junctionTreeStrategy () 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... | |
The default triangulation algorithm used by aGrUM.
By default, this is the very class used by aGrUM for performing triangulations. The algorithm used is the following:
triangulated
The triangulation step first tries to remove simplicial nodes, that is, nodes that belong to only one clique. Then almost simplicial nodes of low width are removed (almost simplicial nodes are nodes such that all but one of their neighbors form a clique). Then quasi simplicial nodes are removed, that is, nodes such that the ratio of the number of fill-ins to add to form a clique by the number of edges in a clique is small. Then nodes that create cliques of small weight are removed.
The transformation from the elimination tree to the join tree is performed bottom-up. Each time a node of the elimination tree is identified to be a sub-clique, it is removed and all of its parents but one are linked to the latter. The identification of sub-cliques is very fast (comparison of 2 ints).
Definition at line 61 of file defaultTriangulation.h.
|
explicit |
basic constructor. initialize the triangulation
|
explicit |
default constructor: initialize the triangulation for an empty graph
gum::DefaultTriangulation::DefaultTriangulation | ( | const DefaultTriangulation & | from | ) |
copy constructor
gum::DefaultTriangulation::DefaultTriangulation | ( | DefaultTriangulation && | from | ) |
move constructor
gum::DefaultTriangulation::~DefaultTriangulation | ( | ) |
destructor
|
virtualinherited |
reinitialize the graph to be triangulated to an empty graph
Implements gum::Triangulation.
Definition at line 154 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
virtual copy constructor
Implements gum::UnconstrainedTriangulation.
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.
|
virtualinherited |
returns the Ids of the cliques of the junction tree created by the elimination of the nodes
Implements gum::Triangulation.
returns the Id of the maximal prime subgraph created by the elimination of a given node during the triangulation process
Implements gum::Triangulation.
|
inherited |
returns the domain sizes of the variables of the graph to be triangulated
|
virtualinherited |
returns an elimination ordering compatible with the triangulated graph
Implements gum::Triangulation.
returns the index of a given node in the elimination order (0 = first node eliminated)
Implements gum::Triangulation.
|
inherited |
returns the elimination sequence strategy used by the triangulation
|
virtualinherited |
returns the elimination tree of a compatible ordering
Implements gum::Triangulation.
|
virtualinherited |
returns the fill-ins added by the triangulation algorithm
Implements gum::Triangulation.
Definition at line 653 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
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).
graph | the very graph that is triangulated (this is a copy of original_graph) |
Reimplemented in gum::PartialOrderedTriangulation, and gum::OrderedTriangulation.
Definition at line 707 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates wether minimality is required
|
virtualinherited |
returns a compatible junction tree
Implements gum::Triangulation.
|
inherited |
returns the junction tree strategy used by the triangulation
|
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 64 of file triangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
returns a junction tree of maximal prime subgraphs
Implements gum::Triangulation.
|
virtual |
virtual clone constructor
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::UnconstrainedTriangulation.
|
private |
forbid copy operator
|
inherited |
returns the graph to be triangulated
|
inherited |
returns a table indicating, for each node, at which step it was deleted by the triangulation process
|
inherited |
sets/unsets the record of the fill-ins in the standard triangulation procedure
|
virtualinherited |
initialize the triangulation data structures for a new graph
graph | the graph to be triangulated, i.e., the nodes of which will be eliminated |
domsizes | the domain sizes of the nodes to be eliminated |
Implements gum::Triangulation.
Reimplemented in gum::PartialOrderedTriangulation, and gum::OrderedTriangulation.
Definition at line 505 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
sets/unset the minimality requirement
|
virtualinherited |
returns the triangulated graph
Implements gum::Triangulation.
Definition at line 466 of file staticTriangulation.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
the ratio above which we consider nodes to be quasi simplicial
Definition at line 106 of file defaultTriangulation.h.
|
private |
threshold under which almost and quasi simplicial nodes can be chosen to be eliminated
Definition at line 110 of file defaultTriangulation.h.
|
protectedinherited |
the domain sizes of the variables/nodes of the graph
Definition at line 150 of file triangulation.h.
|
protectedinherited |
the elimination sequence strategy used by the triangulation
Definition at line 229 of file staticTriangulation.h.
|
protectedinherited |
the junction tree strategy used by the triangulation
Definition at line 232 of file staticTriangulation.h.