aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::Triangulation Class Referenceabstract

Interface for all the triangulation methods. More...

#include <triangulation.h>

Inheritance diagram for gum::Triangulation:
Collaboration diagram for gum::Triangulation:

Public Member Functions

Constructors / Destructors
virtual TriangulationnewFactory () const =0
 returns a fresh triangulation of the same type as the current object but with an empty graph
virtual TriangulationcopyFactory () const =0
 virtual copy constructor
virtual ~Triangulation ()
 destructor
Accessors / Modifiers
virtual void setGraph (const UndiGraph *graph, const NodeProperty< Size > *domsizes)=0
 initialize the triangulation data structures for a new graph
virtual const EdgeSetfillIns ()=0
 returns the fill-ins added by the triangulation algorithm
virtual const std::vector< NodeId > & eliminationOrder ()=0
 returns an elimination ordering compatible with the triangulated graph
virtual Idx eliminationOrder (const NodeId)=0
 returns the index of a given node in the elimination order (0 = first node eliminated)
virtual const UndiGraphtriangulatedGraph ()=0
 returns the triangulated graph
virtual const CliqueGrapheliminationTree ()=0
 returns the elimination tree of a compatible ordering
virtual const CliqueGraphjunctionTree ()=0
 returns a compatible junction tree
double maxLog10CliqueDomainSize ()
 returns the max of log10DomainSize of the cliques in the junction tree.
virtual NodeId createdJunctionTreeClique (const NodeId id)=0
 returns the Id of the clique created by the elimination of a given node during the triangulation process
virtual const NodeProperty< NodeId > & createdJunctionTreeCliques ()=0
 returns the Ids of the cliques of the junction tree created by the elimination of the nodes
virtual const CliqueGraphmaxPrimeSubgraphTree ()=0
 returns a junction tree of maximal prime subgraphs
virtual NodeId createdMaxPrimeSubgraph (const NodeId id)=0
 returns the Id of the maximal prime subgraph created by the elimination of a given node during the triangulation process
virtual void clear ()=0
 reinitialize the graph to be triangulated to an empty graph
const NodeProperty< Size > * domainSizes () const
 returns the domain sizes of the variables of the graph to be triangulated

Protected Member Functions

 Triangulation ()
 default constructor
 Triangulation (const NodeProperty< Size > *domsizes)
 constructor with a domain size specified
 Triangulation (const Triangulation &)
 prevent copy constructor except when using newFactory
 Triangulation (Triangulation &&)
 prevent move constructor except when used by children

Protected Attributes

const NodeProperty< Size > * domain_sizes_ {nullptr}
 the domain sizes of the variables/nodes of the graph

Private Member Functions

Triangulationoperator= (const Triangulation &)
 prevent copy operator

Detailed Description

Interface for all the triangulation methods.

Definition at line 66 of file triangulation.h.

Constructor & Destructor Documentation

◆ ~Triangulation()

gum::Triangulation::~Triangulation ( )
virtual

destructor

Definition at line 71 of file triangulation.cpp.

71 { // for debugging purposes
72 GUM_DESTRUCTOR(Triangulation);
73 }
Triangulation()
default constructor

References Triangulation().

Here is the call graph for this function:

◆ Triangulation() [1/4]

gum::Triangulation::Triangulation ( )
protected

default constructor

Definition at line 61 of file triangulation.cpp.

61 { // for debugging purposes
62 GUM_CONSTRUCTOR(Triangulation);
63 }

References Triangulation().

Referenced by gum::StaticTriangulation::StaticTriangulation(), gum::StaticTriangulation::StaticTriangulation(), gum::StaticTriangulation::StaticTriangulation(), Triangulation(), Triangulation(), Triangulation(), Triangulation(), ~Triangulation(), copyFactory(), newFactory(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Triangulation() [2/4]

gum::Triangulation::Triangulation ( const NodeProperty< Size > * domsizes)
protected

constructor with a domain size specified

Warning
note that, by aGrUM's rule, domsizes is not copied but only referenced by the triangulation algorithm.

Definition at line 66 of file triangulation.cpp.

66 : domain_sizes_(domsizes) {
67 GUM_CONSTRUCTOR(Triangulation);
68 }
const NodeProperty< Size > * domain_sizes_
the domain sizes of the variables/nodes of the graph

References Triangulation(), and domain_sizes_.

Here is the call graph for this function:

◆ Triangulation() [3/4]

gum::Triangulation::Triangulation ( const Triangulation & from)
protected

prevent copy constructor except when using newFactory

Definition at line 76 of file triangulation.cpp.

76 : domain_sizes_(from.domain_sizes_) {
77 GUM_CONS_CPY(Triangulation);
78 }

References Triangulation(), and domain_sizes_.

Here is the call graph for this function:

◆ Triangulation() [4/4]

gum::Triangulation::Triangulation ( Triangulation && from)
protected

prevent move constructor except when used by children

Definition at line 81 of file triangulation.cpp.

81 : domain_sizes_(from.domain_sizes_) {
82 GUM_CONS_MOV(Triangulation);
83 }

References Triangulation(), and domain_sizes_.

Here is the call graph for this function:

Member Function Documentation

◆ clear()

virtual void gum::Triangulation::clear ( )
pure virtual

reinitialize the graph to be triangulated to an empty graph

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ copyFactory()

virtual Triangulation * gum::Triangulation::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++.

Implemented in gum::DefaultTriangulation, gum::IncrementalTriangulation, gum::OrderedTriangulation, gum::PartialOrderedTriangulation, gum::StaticTriangulation, and gum::UnconstrainedTriangulation.

References Triangulation().

Here is the call graph for this function:

◆ createdJunctionTreeClique()

virtual NodeId gum::Triangulation::createdJunctionTreeClique ( const NodeId id)
pure virtual

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

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ createdJunctionTreeCliques()

virtual const NodeProperty< NodeId > & gum::Triangulation::createdJunctionTreeCliques ( )
pure virtual

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

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ createdMaxPrimeSubgraph()

virtual NodeId gum::Triangulation::createdMaxPrimeSubgraph ( const NodeId id)
pure virtual

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

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ domainSizes()

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

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

◆ eliminationOrder() [1/2]

virtual const std::vector< NodeId > & gum::Triangulation::eliminationOrder ( )
pure virtual

returns an elimination ordering compatible with the triangulated graph

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ eliminationOrder() [2/2]

virtual Idx gum::Triangulation::eliminationOrder ( const NodeId )
pure virtual

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

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ eliminationTree()

virtual const CliqueGraph & gum::Triangulation::eliminationTree ( )
pure virtual

returns the elimination tree of a compatible ordering

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ fillIns()

virtual const EdgeSet & gum::Triangulation::fillIns ( )
pure virtual

returns the fill-ins added by the triangulation algorithm

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ junctionTree()

virtual const CliqueGraph & gum::Triangulation::junctionTree ( )
pure virtual

returns a compatible junction tree

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

Referenced by maxLog10CliqueDomainSize().

Here is the caller graph for this function:

◆ maxLog10CliqueDomainSize()

double gum::Triangulation::maxLog10CliqueDomainSize ( )

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 86 of file triangulation.cpp.

86 {
87 double res = 0.0;
88 double dSize;
89 const JunctionTree& jt = junctionTree(); // here, the fact that we get
90 // a junction tree ensures that domain_sizes_ is different from nullptr
91
92 for (const NodeId cl: jt) {
93 dSize = 0.0;
94
95 for (const auto node: jt.clique(cl))
96 dSize += std::log10((*domain_sizes_)[node]);
97
98 if (res < dSize) res = dSize;
99 }
100
101 return res;
102 }
virtual const CliqueGraph & junctionTree()=0
returns a compatible junction tree
Size NodeId
Type for node ids.
CliqueGraph JunctionTree
a junction tree is a clique graph satisfying the running intersection property and such that no cliqu...

References gum::CliqueGraph::clique(), domain_sizes_, and junctionTree().

Referenced by gum::MaxInducedWidthMCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::_checkConditions_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ maxPrimeSubgraphTree()

virtual const CliqueGraph & gum::Triangulation::maxPrimeSubgraphTree ( )
pure virtual

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.

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

◆ newFactory()

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

returns a fresh triangulation of the same type as the current object but with an empty graph

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++.

Implemented in gum::DefaultTriangulation, gum::IncrementalTriangulation, gum::OrderedTriangulation, gum::PartialOrderedTriangulation, gum::StaticTriangulation, and gum::UnconstrainedTriangulation.

References Triangulation().

Here is the call graph for this function:

◆ operator=()

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

prevent copy operator

References Triangulation().

Here is the call graph for this function:

◆ setGraph()

virtual void gum::Triangulation::setGraph ( const UndiGraph * graph,
const NodeProperty< Size > * domsizes )
pure virtual

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.

Implemented in gum::IncrementalTriangulation, gum::OrderedTriangulation, gum::PartialOrderedTriangulation, and gum::StaticTriangulation.

◆ triangulatedGraph()

virtual const UndiGraph & gum::Triangulation::triangulatedGraph ( )
pure virtual

returns the triangulated graph

Implemented in gum::IncrementalTriangulation, and gum::StaticTriangulation.

Member Data Documentation

◆ domain_sizes_

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

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