aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::DiscreteGraphicalModel Class Referenceabstract

<agrum/base/graphicalModels/discreteGraphicalModel.h> More...

#include <discreteGraphicalModel.h>

Inheritance diagram for gum::DiscreteGraphicalModel:
Collaboration diagram for gum::DiscreteGraphicalModel:

Public Member Functions

double log10DomainSize () const
virtual bool isIndependent (NodeId X, NodeId Y, const NodeSet &Z) const =0
 check if node X and node Y are independent given nodes Z
virtual bool isIndependent (const NodeSet &X, const NodeSet &Y, const NodeSet &Z) const =0
 check if nodes X and nodes Y are independent given nodes Z
virtual NodeSet family (const NodeId id) const =0
 returns the family of a noe (parents or neighbours) of a node and the node
virtual NodeSet family (std::string_view name) const =0
Constructors / Destructors
 DiscreteGraphicalModel ()
 ~DiscreteGraphicalModel () override
 DiscreteGraphicalModel (const DiscreteGraphicalModel &source)
 DiscreteGraphicalModel (DiscreteGraphicalModel &&source)
Variable accessor methods
const VariableNodeMapvariableNodeMap () const override
 Returns a constant reference to the VariableNodeMap of this model.
const DiscreteVariablevariable (NodeId id) const override
 Returns a constant reference over a variable given its node id.
NodeId nodeId (const DiscreteVariable &var) const override
 Returns the NodeId of a variable.
NodeId idFromName (std::string_view name) const override
 Returns the NodeId of a variable given its name.
const DiscreteVariablevariableFromName (std::string_view name) const override
 Returns a constant reference over a variable given its name.
Getter and setters
const std::string & property (std::string_view name) const
 Return the value of the property name of this GraphicalModel.
const std::string & propertyWithDefault (std::string_view name, const std::string &byDefault) const
 Return the value of the property name of this GraphicalModel.
void setProperty (std::string_view name, std::string_view value)
 Add or change a property of this GraphicalModel.
std::vector< std::string > properties () const
 List of all the names of property in the Graphical model.
bool existsProperty (std::string_view name) const
 check wether a property exists in this GraphicalModel
void updateMetaData ()
 update the meta data of this Graphical Model (version, creation date, last modification date) This method is called by the writers ONLY before writing the model to a file.
Variable manipulation methods.
virtual Size size () const =0
 Returns the number of variables in this Directed Graphical Model.
virtual bool empty () const
 Return true if this graphical model is empty.
virtual bool exists (NodeId node) const =0
 Return true if this node exists in this graphical model.
virtual bool exists (std::string_view name) const =0
 Returns the number of variables in this Directed Graphical Model.
std::vector< std::string > names (const std::vector< NodeId > &ids) const
 transform a vector of NodeId in a vector of names
std::vector< std::string > names (const NodeSet &ids) const
 transform a NodeSet in a vector of names
std::vector< NodeIdids (const std::vector< std::string > &names) const
 transform a vector of names into a vector of nodeId
NodeSet nodeset (const std::vector< std::string > &names) const
 transform a vector of names into a NodeSet
gum::VariableSet variables (const std::vector< std::string > &l) const
 transform a vector of names into a VariableeSet
gum::VariableSet variables (const NodeSet &ids) const
 transform a vector of NodeId into a VariableeSet
virtual const NodeGraphPartnodes () const =0
 Returns the number of variables in this Directed Graphical Model.
Instantiation completeInstantiation () const
 Get an instantiation over all the variables of the model.

Static Public Member Functions

static std::string spaceCplxToString (double dSize, int dim, Size usedMem)
 send to the stream the space complexity with 3 parametrs

Protected Member Functions

DiscreteGraphicalModeloperator= (const DiscreteGraphicalModel &source)
DiscreteGraphicalModeloperator= (DiscreteGraphicalModel &&source)
void _nameNodes_ (NodeGraphPart &g) const
 Names every node of g using variable(id).name() for each node id in g.

Protected Attributes

VariableNodeMap varMap_
 Mapping between NodeIds and discrete variables.

Private Member Functions

const HashTable< std::string, std::string > & _properties_ () const
 Return the properties of this Directed Graphical Model.

Private Attributes

HashTable< std::string, std::string > _propertiesMap_
 The properties of this Directed Graphical Model.

Detailed Description

<agrum/base/graphicalModels/discreteGraphicalModel.h>

Intermediate base class for graphical models over discrete variables.

Owns a VariableNodeMap and provides concrete implementations of the five variable-accessor methods declared pure virtual in GraphicalModel (variableNodeMap, variable, nodeId, idFromName, variableFromName). All concrete models (BayesNet, MarkovRandomField, InfluenceDiagram, …) inherit from this class via DAGmodel or UGmodel.

Definition at line 69 of file discreteGraphicalModel.h.

Constructor & Destructor Documentation

◆ DiscreteGraphicalModel() [1/3]

gum::DiscreteGraphicalModel::DiscreteGraphicalModel ( )

Definition at line 50 of file discreteGraphicalModel.cpp.

References DiscreteGraphicalModel().

Referenced by gum::DAGmodel::DAGmodel(), gum::DAGmodel::DAGmodel(), DiscreteGraphicalModel(), DiscreteGraphicalModel(), DiscreteGraphicalModel(), gum::UGmodel::UGmodel(), gum::UGmodel::UGmodel(), ~DiscreteGraphicalModel(), operator=(), and operator=().

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

◆ ~DiscreteGraphicalModel()

gum::DiscreteGraphicalModel::~DiscreteGraphicalModel ( )
override

Definition at line 62 of file discreteGraphicalModel.cpp.

62{ GUM_DESTRUCTOR(DiscreteGraphicalModel); }

References DiscreteGraphicalModel().

Here is the call graph for this function:

◆ DiscreteGraphicalModel() [2/3]

gum::DiscreteGraphicalModel::DiscreteGraphicalModel ( const DiscreteGraphicalModel & source)

Definition at line 52 of file discreteGraphicalModel.cpp.

52 :
53 GraphicalModel(from), varMap_(from.varMap_) {
54 GUM_CONS_CPY(DiscreteGraphicalModel);
55 }
VariableNodeMap varMap_
Mapping between NodeIds and discrete variables.
GraphicalModel()
Default constructor.

References DiscreteGraphicalModel(), gum::GraphicalModel::GraphicalModel(), and varMap_.

Here is the call graph for this function:

◆ DiscreteGraphicalModel() [3/3]

gum::DiscreteGraphicalModel::DiscreteGraphicalModel ( DiscreteGraphicalModel && source)

Definition at line 57 of file discreteGraphicalModel.cpp.

57 :
58 GraphicalModel(std::move(from)), varMap_(std::move(from.varMap_)) {
59 GUM_CONS_MOV(DiscreteGraphicalModel);
60 }

References DiscreteGraphicalModel(), gum::GraphicalModel::GraphicalModel(), and varMap_.

Here is the call graph for this function:

Member Function Documentation

◆ _nameNodes_()

INLINE void gum::GraphicalModel::_nameNodes_ ( NodeGraphPart & g) const
protectedinherited

Names every node of g using variable(id).name() for each node id in g.

Call this before returning any newly constructed graph from a model method.

Definition at line 175 of file graphicalModel_inl.h.

175 {
176 for (auto id: g)
177 g.setName(id, variable(id).name());
178 }
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it's node id.

References gum::NodeGraphPart::setName(), and variable().

Referenced by gum::DAGmodel::dag(), gum::UGmodel::graph(), gum::DAGmodel::moralGraph(), and gum::DAGmodel::moralizedAncestralGraph().

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

◆ _properties_()

INLINE const HashTable< std::string, std::string > & gum::GraphicalModel::_properties_ ( ) const
privateinherited

Return the properties of this Directed Graphical Model.

Definition at line 67 of file graphicalModel_inl.h.

67 {
68 return _propertiesMap_;
69 }
HashTable< std::string, std::string > _propertiesMap_
The properties of this Directed Graphical Model.

References _propertiesMap_.

Referenced by property().

Here is the caller graph for this function:

◆ completeInstantiation()

INLINE Instantiation gum::GraphicalModel::completeInstantiation ( ) const
inherited

Get an instantiation over all the variables of the model.

Definition at line 104 of file graphicalModel_inl.h.

104 {
105 Instantiation I;
106
107 for (const auto node: nodes())
108 I << variable(node);
109
110 return I;
111 }
virtual const NodeGraphPart & nodes() const =0
Returns the number of variables in this Directed Graphical Model.

References nodes(), and variable().

Here is the call graph for this function:

◆ empty()

INLINE bool gum::GraphicalModel::empty ( ) const
virtualinherited

Return true if this graphical model is empty.

Definition at line 114 of file graphicalModel_inl.h.

114{ return size() == 0; }
virtual Size size() const =0
Returns the number of variables in this Directed Graphical Model.

References size().

Referenced by gum::IBayesNet< GUM_SCALAR >::check(), and gum::BayesNet< GUM_SCALAR >::clear().

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

◆ exists() [1/2]

virtual bool gum::GraphicalModel::exists ( NodeId node) const
pure virtualinherited

Return true if this node exists in this graphical model.

Implemented in gum::DAGmodel, and gum::UGmodel.

◆ exists() [2/2]

virtual bool gum::GraphicalModel::exists ( std::string_view name) const
pure virtualinherited

Returns the number of variables in this Directed Graphical Model.

Implemented in gum::DAGmodel, and gum::UGmodel.

References ids(), and names().

Here is the call graph for this function:

◆ existsProperty()

INLINE bool gum::GraphicalModel::existsProperty ( std::string_view name) const
inherited

check wether a property exists in this GraphicalModel

Definition at line 170 of file graphicalModel_inl.h.

170 {
171 return _propertiesMap_.exists(name);
172 }

References _propertiesMap_.

◆ family() [1/2]

virtual NodeSet gum::GraphicalModel::family ( const NodeId id) const
pure virtualinherited

returns the family of a noe (parents or neighbours) of a node and the node

Parameters
idthe node which is the head of an arc with the returned nodes
namethe name of the node the node which is the head of an arc with the returned nodes

Implemented in gum::DAGmodel, and gum::UGmodel.

◆ family() [2/2]

virtual NodeSet gum::GraphicalModel::family ( std::string_view name) const
pure virtualinherited

Implemented in gum::DAGmodel, and gum::UGmodel.

References GraphicalModel().

Here is the call graph for this function:

◆ idFromName()

◆ ids()

INLINE std::vector< NodeId > gum::GraphicalModel::ids ( const std::vector< std::string > & names) const
inherited

transform a vector of names into a vector of nodeId

Returns
the vector of names

Definition at line 139 of file graphicalModel_inl.h.

139 {
140 std::vector< NodeId > res;
141 const VariableNodeMap& v = variableNodeMap();
142 std::transform(names.cbegin(),
143 names.cend(),
144 std::back_inserter(res),
145 [&v](const std::string& n) { return v.idFromName(n); });
146 return res;
147 }
virtual const VariableNodeMap & variableNodeMap() const =0
Returns a constant reference to the VariableNodeMap of this Graphical Model.
std::vector< std::string > names(const std::vector< NodeId > &ids) const
transform a vector of NodeId in a vector of names

References names(), and variableNodeMap().

Referenced by gum::DAGmodel::children(), exists(), names(), names(), and gum::DAGmodel::parents().

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

◆ isIndependent() [1/2]

virtual bool gum::GraphicalModel::isIndependent ( const NodeSet & X,
const NodeSet & Y,
const NodeSet & Z ) const
pure virtualinherited

check if nodes X and nodes Y are independent given nodes Z

Implemented in gum::DAGmodel, and gum::UGmodel.

◆ isIndependent() [2/2]

virtual bool gum::GraphicalModel::isIndependent ( NodeId X,
NodeId Y,
const NodeSet & Z ) const
pure virtualinherited

check if node X and node Y are independent given nodes Z

Implemented in gum::DAGmodel, and gum::UGmodel.

◆ log10DomainSize()

INLINE double gum::GraphicalModel::log10DomainSize ( ) const
inherited

Definition at line 93 of file graphicalModel_inl.h.

93 {
94 double dSize = 0.0;
95
96 for (const auto node: nodes()) {
97 dSize += std::log10(variable(node).domainSize());
98 }
99
100 return dSize;
101 }

References nodes().

Referenced by gum::IMarkovRandomField< GUM_SCALAR >::toString(), and gum::InfluenceDiagram< GUM_SCALAR >::toString().

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

◆ names() [1/2]

INLINE std::vector< std::string > gum::GraphicalModel::names ( const NodeSet & ids) const
inherited

transform a NodeSet in a vector of names

Returns
the vector of names

Definition at line 129 of file graphicalModel_inl.h.

129 {
130 const VariableNodeMap& v = variableNodeMap();
131 std::vector< std::string > res;
132 for (auto n: ids) {
133 res.push_back(v.name(n));
134 }
135 return res;
136 }
std::vector< NodeId > ids(const std::vector< std::string > &names) const
transform a vector of names into a vector of nodeId

References ids(), gum::VariableNodeMap::name(), and variableNodeMap().

Here is the call graph for this function:

◆ names() [2/2]

INLINE std::vector< std::string > gum::GraphicalModel::names ( const std::vector< NodeId > & ids) const
inherited

transform a vector of NodeId in a vector of names

Returns
the vector of names

Definition at line 117 of file graphicalModel_inl.h.

117 {
118 std::vector< std::string > res;
119 const VariableNodeMap& v = variableNodeMap();
120
121 std::ranges::transform(ids, std::back_inserter(res), [&v](const NodeId n) {
122 return v[n].name();
123 });
124
125 return res;
126 }
Size NodeId
Type for node ids.

References ids().

Referenced by gum::DAGmodel::children(), exists(), ids(), nodeset(), and gum::DAGmodel::parents().

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

◆ nodeId()

INLINE NodeId gum::DiscreteGraphicalModel::nodeId ( const DiscreteVariable & var) const
overridevirtual

Returns the NodeId of a variable.

Exceptions
NotFoundif no variable matches var.

Implements gum::GraphicalModel.

Reimplemented in gum::InfluenceDiagram< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.

Definition at line 56 of file discreteGraphicalModel_inl.h.

56 {
57 return varMap_.get(var);
58 }

References varMap_.

Referenced by gum::InfluenceDiagram< GUM_SCALAR >::clear(), gum::BayesBall::relevantTensors(), and gum::dSeparationAlgorithm::relevantTensors().

Here is the caller graph for this function:

◆ nodes()

virtual const NodeGraphPart & gum::GraphicalModel::nodes ( ) const
pure virtualinherited

Returns the number of variables in this Directed Graphical Model.

Implemented in gum::DAGmodel, and gum::UGmodel.

Referenced by completeInstantiation(), and log10DomainSize().

Here is the caller graph for this function:

◆ nodeset()

NodeSet gum::GraphicalModel::nodeset ( const std::vector< std::string > & names) const
inherited

transform a vector of names into a NodeSet

Returns
NodeSet

Definition at line 102 of file graphicalModel.cpp.

102 {
103 NodeSet res;
104 for (const auto& name: names) {
105 res.insert(idFromName(name));
106 }
107 return res;
108 }
virtual NodeId idFromName(std::string_view name) const =0
Getter by name.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...

References idFromName(), gum::Set< Key >::insert(), and names().

Referenced by gum::BayesNet< double >::ancestors(), gum::DAGmodel::children(), gum::DAGmodel::isIndependent(), gum::UGmodel::isIndependent(), gum::UGmodel::isIndependent(), gum::DAGmodel::minimalCondSet(), and gum::DAGmodel::moralizedAncestralGraph().

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

◆ operator=() [1/2]

DiscreteGraphicalModel & gum::DiscreteGraphicalModel::operator= ( const DiscreteGraphicalModel & source)
protected

Definition at line 64 of file discreteGraphicalModel.cpp.

64 {
65 if (this != &source) {
67 varMap_ = source.varMap_;
68 GUM_OP_CPY(DiscreteGraphicalModel);
69 }
70 return *this;
71 }
GraphicalModel & operator=(const GraphicalModel &source)
Private copy operator.

References DiscreteGraphicalModel(), gum::GraphicalModel::operator=(), and varMap_.

Referenced by gum::DAGmodel::operator=(), gum::DAGmodel::operator=(), gum::UGmodel::operator=(), and gum::UGmodel::operator=().

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

◆ operator=() [2/2]

DiscreteGraphicalModel & gum::DiscreteGraphicalModel::operator= ( DiscreteGraphicalModel && source)
protected

Definition at line 73 of file discreteGraphicalModel.cpp.

73 {
74 if (this != &source) {
75 GraphicalModel::operator=(std::move(source));
76 varMap_ = std::move(source.varMap_);
77 GUM_OP_MOV(DiscreteGraphicalModel);
78 }
79 return *this;
80 }

References DiscreteGraphicalModel(), gum::GraphicalModel::operator=(), and varMap_.

Here is the call graph for this function:

◆ properties()

INLINE std::vector< std::string > gum::GraphicalModel::properties ( ) const
inherited

List of all the names of property in the Graphical model.

Definition at line 79 of file graphicalModel_inl.h.

79 {
80 std::vector< std::string > prop;
81 for (const auto& [p, v]: _propertiesMap_)
82 prop.push_back(p);
83 return prop;
84 }

References _propertiesMap_.

◆ property()

INLINE const std::string & gum::GraphicalModel::property ( std::string_view name) const
inherited

Return the value of the property name of this GraphicalModel.

Exceptions
NotFoundRaised if no name property is found.

Definition at line 60 of file graphicalModel_inl.h.

60 {
61 auto p = _properties_().tryGet(name);
62 if (!p) { GUM_ERROR(NotFound, "The following property does not exists: " << name) }
63 return *p;
64 }
const HashTable< std::string, std::string > & _properties_() const
Return the properties of this Directed Graphical Model.
optional_ref< Val > tryGet(const Key &key)
Returns a pointer to the value associated with a given key, or nullptr if the key does not exist.
#define GUM_ERROR(type, msg)
Definition exceptions.h:76

References _properties_(), GUM_ERROR, and gum::HashTable< Key, Val >::tryGet().

Here is the call graph for this function:

◆ propertyWithDefault()

INLINE const std::string & gum::GraphicalModel::propertyWithDefault ( std::string_view name,
const std::string & byDefault ) const
inherited

Return the value of the property name of this GraphicalModel.

return byDefault if the property name is not found

Definition at line 72 of file graphicalModel_inl.h.

73 {
74 auto p = _propertiesMap_.tryGet(name);
75 return p ? *p : byDefault;
76 }

References _propertiesMap_.

Referenced by gum::IBayesNet< GUM_SCALAR >::toDot(), gum::IMarkovRandomField< GUM_SCALAR >::toDot(), gum::InfluenceDiagram< GUM_SCALAR >::toDot(), and gum::IMarkovRandomField< GUM_SCALAR >::toDotAsFactorGraph().

Here is the caller graph for this function:

◆ setProperty()

INLINE void gum::GraphicalModel::setProperty ( std::string_view name,
std::string_view value )
inherited

Add or change a property of this GraphicalModel.

Definition at line 87 of file graphicalModel_inl.h.

87 {
88 if (auto p = _propertiesMap_.tryGet(name)) *p = value;
89 else _propertiesMap_.insert(std::string(name), std::string(value));
90 }

References _propertiesMap_.

Referenced by gum::IBayesNet< GUM_SCALAR >::IBayesNet(), gum::IMarkovRandomField< GUM_SCALAR >::IMarkovRandomField(), and gum::InfluenceDiagram< GUM_SCALAR >::fastPrototype().

Here is the caller graph for this function:

◆ size()

virtual Size gum::GraphicalModel::size ( ) const
pure virtualinherited

Returns the number of variables in this Directed Graphical Model.

Implemented in gum::DAGmodel, and gum::UGmodel.

Referenced by empty().

Here is the caller graph for this function:

◆ spaceCplxToString()

std::string gum::GraphicalModel::spaceCplxToString ( double dSize,
int dim,
Size usedMem )
staticinherited

send to the stream the space complexity with 3 parametrs

Parameters
sthe stream
dSizethe log10domainSize
dimthe dimension
usedMemthe memory needed for the params

Definition at line 110 of file graphicalModel.cpp.

110 {
111 std::string result;
112 if (dSize > 6) result = std::format("domainSize: 10^{:.6g}", dSize);
113 else result = std::format("domainSize: {}", (long long)std::round(std::pow(10.0, dSize)));
114
115 result += std::format(", dim: {}, mem: ", dim);
116
117 if (const Size go = usedMem / (1024 * 1024 * 1024); go > 0) result += std::format("{}Go ", go);
118 if (const Size mo = (usedMem / (1024 * 1024)) % 1024; mo > 0)
119 result += std::format("{}Mo ", mo);
120 if (const Size ko = (usedMem / 1024) % 1024; ko > 0) result += std::format("{}Ko ", ko);
121 result += std::format("{}o", usedMem % 1024);
122 return result;
123 }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74

◆ updateMetaData()

void gum::GraphicalModel::updateMetaData ( )
inherited

update the meta data of this Graphical Model (version, creation date, last modification date) This method is called by the writers ONLY before writing the model to a file.

Definition at line 81 of file graphicalModel.cpp.

81 {
82 auto const time = std::chrono::time_point_cast< std::chrono::milliseconds >(
83 std::chrono::system_clock::now());
84 auto const currentdate = std::format("{:%Y-%m-%d %T}", time);
85
86 const std::string currentSoftware = "aGrUM " GUM_VERSION;
87 if (auto software = _propertiesMap_.tryGet("software")) {
88 *software = currentSoftware;
89 } else {
90 _propertiesMap_.insert("software", currentSoftware);
91 }
92
93 if (!_propertiesMap_.tryGet("creation")) { _propertiesMap_.insert("creation", currentdate); }
94
95 if (auto lastModification = _propertiesMap_.tryGet("lastModification")) {
96 *lastModification = currentdate;
97 } else {
98 _propertiesMap_.insert("lastModification", currentdate);
99 }
100 }

References _propertiesMap_.

◆ variable()

◆ variableFromName()

INLINE const DiscreteVariable & gum::DiscreteGraphicalModel::variableFromName ( std::string_view name) const
overridevirtual

Returns a constant reference over a variable given its name.

Exceptions
NotFoundif no such name exists in the model.

Implements gum::GraphicalModel.

Reimplemented in gum::InfluenceDiagram< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.

Definition at line 66 of file discreteGraphicalModel_inl.h.

66 {
67 return varMap_.variableFromName(name);
68 }

References varMap_.

Referenced by gum::InfluenceDiagram< GUM_SCALAR >::clear(), gum::IBayesNet< GUM_SCALAR >::evEq(), gum::IBayesNet< GUM_SCALAR >::evGt(), gum::IBayesNet< GUM_SCALAR >::evIn(), gum::IBayesNet< GUM_SCALAR >::evLt(), gum::IBayesNet< GUM_SCALAR >::operator==(), and gum::IMarkovRandomField< GUM_SCALAR >::operator==().

Here is the caller graph for this function:

◆ variableNodeMap()

INLINE const VariableNodeMap & gum::DiscreteGraphicalModel::variableNodeMap ( ) const
overridevirtual

Returns a constant reference to the VariableNodeMap of this model.

Implements gum::GraphicalModel.

Reimplemented in gum::InfluenceDiagram< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.

Definition at line 48 of file discreteGraphicalModel_inl.h.

48{ return varMap_; }

References varMap_.

Referenced by gum::InfluenceDiagram< GUM_SCALAR >::clear().

Here is the caller graph for this function:

◆ variables() [1/2]

INLINE VariableSet gum::GraphicalModel::variables ( const NodeSet & ids) const
inherited

transform a vector of NodeId into a VariableeSet

Returns
NodeSet

Definition at line 160 of file graphicalModel_inl.h.

160 {
161 VariableSet s;
162 const VariableNodeMap& v = variableNodeMap();
163 for (const auto& node: l) {
164 s.insert(&v.get(node));
165 }
166 return s;
167 }
Set< const DiscreteVariable * > VariableSet

◆ variables() [2/2]

INLINE VariableSet gum::GraphicalModel::variables ( const std::vector< std::string > & l) const
inherited

transform a vector of names into a VariableeSet

Returns
NodeSet

Definition at line 150 of file graphicalModel_inl.h.

150 {
151 VariableSet s;
152 const VariableNodeMap& v = variableNodeMap();
153 for (const auto& name: l) {
154 s.insert(&v.variableFromName(name));
155 }
156 return s;
157 }

References gum::Set< Key >::insert(), gum::VariableNodeMap::variableFromName(), and variableNodeMap().

Here is the call graph for this function:

Member Data Documentation

◆ _propertiesMap_

HashTable< std::string, std::string > gum::GraphicalModel::_propertiesMap_
privateinherited

The properties of this Directed Graphical Model.

Definition at line 262 of file graphicalModel.h.

Referenced by GraphicalModel(), GraphicalModel(), _properties_(), existsProperty(), operator=(), operator=(), properties(), propertyWithDefault(), setProperty(), and updateMetaData().

◆ varMap_


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