aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
triangulation.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
47#ifndef GUM_TRIANGULATION_H
48#define GUM_TRIANGULATION_H
49
50#include <vector>
51
52#include <agrum/agrum.h>
53
56
57namespace gum {
58
59
67 public:
68 // ############################################################################
70 // ############################################################################
72
79 virtual Triangulation* newFactory() const = 0;
80
82
85 virtual Triangulation* copyFactory() const = 0;
86
88 virtual ~Triangulation();
89
91
92
93 // ############################################################################
95 // ############################################################################
97
99
107 virtual void setGraph(const UndiGraph* graph, const NodeProperty< Size >* domsizes) = 0;
108
110 virtual const EdgeSet& fillIns() = 0;
111
113 virtual const std::vector< NodeId >& eliminationOrder() = 0;
114
117 virtual Idx eliminationOrder(const NodeId) = 0;
118
120 virtual const UndiGraph& triangulatedGraph() = 0;
121
123 virtual const CliqueGraph& eliminationTree() = 0;
124
126 virtual const CliqueGraph& junctionTree() = 0;
127
129
136
140
144
146
152 virtual const CliqueGraph& maxPrimeSubgraphTree() = 0;
153
156 virtual NodeId createdMaxPrimeSubgraph(const NodeId id) = 0;
157
159 virtual void clear() = 0;
160
164
166
167
168 protected:
171
172
175
177
179 Triangulation(const NodeProperty< Size >* domsizes);
180
183
186
187
188 private:
191 };
192
193} /* namespace gum */
194
195
196#ifndef GUM_NO_INLINE
198#endif // GUM_NO_INLINE
199
200
201#endif /* GUM_TRIANGULATION_H */
Basic graph of cliques.
Definition cliqueGraph.h:77
Interface for all the triangulation methods.
virtual Triangulation * copyFactory() const =0
virtual copy constructor
virtual const CliqueGraph & maxPrimeSubgraphTree()=0
returns a junction tree of maximal prime subgraphs
virtual Triangulation * newFactory() const =0
returns a fresh triangulation of the same type as the current object but with an empty graph
virtual NodeId createdJunctionTreeClique(const NodeId id)=0
returns the Id of the clique created by the elimination of a given node during the triangulation proc...
virtual const NodeProperty< NodeId > & createdJunctionTreeCliques()=0
returns the Ids of the cliques of the junction tree created by the elimination of the nodes
Triangulation & operator=(const Triangulation &)
prevent copy operator
virtual void clear()=0
reinitialize the graph to be triangulated to an empty graph
virtual const CliqueGraph & eliminationTree()=0
returns the elimination tree of a compatible ordering
virtual const CliqueGraph & junctionTree()=0
returns a compatible junction tree
const NodeProperty< Size > * domain_sizes_
the domain sizes of the variables/nodes of the graph
const NodeProperty< Size > * domainSizes() const
returns the domain sizes of the variables of the graph to be triangulated
virtual const UndiGraph & triangulatedGraph()=0
returns the triangulated graph
double maxLog10CliqueDomainSize()
returns the max of log10DomainSize of the cliques in the junction tree.
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes)=0
initialize the triangulation data structures for a new graph
virtual const EdgeSet & fillIns()=0
returns the fill-ins added by the triangulation algorithm
virtual ~Triangulation()
destructor
virtual Idx eliminationOrder(const NodeId)=0
returns the index of a given node in the elimination order (0 = first node eliminated)
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 tr...
virtual const std::vector< NodeId > & eliminationOrder()=0
returns an elimination ordering compatible with the triangulated graph
Triangulation()
default constructor
Base class for undirected graphs.
Definition undiGraph.h:128
Basic class for all graphs of cliques (join trees, etc).
Size Idx
Type for indexes.
Definition types.h:79
Set< Edge > EdgeSet
Some typdefs and define for shortcuts ...
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Header file of gum::Sequence, a class for storing (ordered) sequences of objects.
Abstract base class for computing triangulations of graphs.