aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
classDependencyGraph.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
48
49#ifndef GUM_ClassDependencyGraph_H
50#define GUM_ClassDependencyGraph_H
51
52#include <agrum/PRM/PRM.h>
53
54namespace gum {
55 namespace prm {
56
65 template < typename GUM_SCALAR >
67 public:
69 using EltPair = std::pair< const PRMClassElementContainer< GUM_SCALAR >*,
71
72 // ========================================================================
74 // ========================================================================
76
81
84
87
89 // ========================================================================
91 // ========================================================================
93
96 const DAG& dag() const;
97
102 const EltPair& get(NodeId id) const;
103
113 const PRMClassElement< GUM_SCALAR >& elt) const;
114
119 const NodeProperty< Size >& modalities() const;
120
122
123 private:
126
130
133 NodeId node,
135
138
145
152
156
161 };
162
163
164#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
165 extern template class ClassDependencyGraph< double >;
166#endif
167
168 } /* namespace prm */
169} /* namespace gum */
170
172
173#endif /* GUM_ClassDependencyGraph_H */
Headers of PRM.
Inline implementation of ClassDependencyGraph.
Base class for dag.
Definition DAG.h:121
The class for generic Hash Tables.
Definition hashTable.h:637
This class represent the dependencies of all classes in a PRM<GUM_SCALAR>.
NodeProperty< EltPair * > _elt_map_
Mapping between the nodes in graph with the PRMClassElement<GUM_SCALAR> in the PRM<GUM_SCALAR>.
NodeProperty< Size > _modalitites_
The modalities map for each node in the ClassDependencyGraph<GUM_SCALAR>. This is useful when using a...
const NodeProperty< Size > & modalities() const
Returns a mapping between the ClassDependencyGraph<GUM_SCALAR>'s nodes and their modalities.
const EltPair & get(NodeId id) const
Returns a constant reference over the element assiociated with the node id in the ClassDependencyGrap...
void _buildGraph_(const PRM< GUM_SCALAR > &prm)
Build the class dependency graph.
ClassDependencyGraph(const PRM< GUM_SCALAR > &prm)
Default constructor.
void _addArcs_(const PRMClassElementContainer< GUM_SCALAR > &c, NodeId node, HashTable< const PRMClassElement< GUM_SCALAR > *, NodeId > &map)
Add arcs in graph.
const DAG & dag() const
Returns a constant reference over the graph of the DAG representing the ClassDependencyGraph<GUM_SCAL...
void _addNode_(const PRMClassElementContainer< GUM_SCALAR > *c, const PRMClassElement< GUM_SCALAR > &elt)
Add nodes in graph while updating consequently all the mappings.
NodeMap _node_map_
Map each Class to a HashTable mapping the Class's ClassElements to their assigned NodeId in graph.
HashTable< const PRMClassElementContainer< GUM_SCALAR > *, HashTable< const PRMClassElement< GUM_SCALAR > *, NodeId > * > NodeMap
Code shortcut.
std::pair< const PRMClassElementContainer< GUM_SCALAR > *, const PRMClassElement< GUM_SCALAR > * > EltPair
Association between a class element and it's holding class.
<agrum/PRM/classElementContainer.h>
Abstract class representing an element of PRM class.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition PRM.h:74
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46