62 if (!p) {
GUM_ERROR(
NotFound,
"The following property does not exists: " << name) }
73 const std::string& byDefault)
const {
75 return p ? *p : byDefault;
80 std::vector< std::string > prop;
96 for (
const auto node:
nodes()) {
97 dSize += std::log10(
variable(node).domainSize());
107 for (
const auto node:
nodes())
118 std::vector< std::string > res;
121 std::ranges::transform(
ids, std::back_inserter(res), [&v](
const NodeId n) {
131 std::vector< std::string > res;
133 res.push_back(v.
name(n));
140 std::vector< NodeId > res;
142 std::transform(
names.cbegin(),
144 std::back_inserter(res),
145 [&v](
const std::string& n) { return v.idFromName(n); });
153 for (
const auto& name: l) {
163 for (
const auto& node: l) {
const HashTable< std::string, std::string > & _properties_() const
Return the properties of this Directed Graphical Model.
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it's node id.
const std::string & property(std::string_view name) const
Return the value of the property name of this GraphicalModel.
void _nameNodes_(NodeGraphPart &g) const
Names every node of g using variable(id).name() for each node id in g.
void setProperty(std::string_view name, std::string_view value)
Add or change a property of this GraphicalModel.
virtual const VariableNodeMap & variableNodeMap() const =0
Returns a constant reference to the VariableNodeMap of this Graphical Model.
HashTable< std::string, std::string > _propertiesMap_
The properties of this Directed Graphical Model.
std::vector< NodeId > ids(const std::vector< std::string > &names) const
transform a vector of names into a vector of nodeId
virtual const NodeGraphPart & nodes() 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
gum::VariableSet variables(const std::vector< std::string > &l) const
transform a vector of names into a VariableeSet
double log10DomainSize() const
std::vector< std::string > properties() const
List of all the names of property in the Graphical model.
Instantiation completeInstantiation() const
Get an instantiation over all the variables of the model.
virtual bool empty() const
Return true if this graphical model is empty.
bool existsProperty(std::string_view name) const
check wether a property exists in 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.
virtual Size size() const =0
Returns the number of variables in 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.
Class for assigning/browsing values to tuples of discrete variables.
Class for node sets in graph.
void setName(NodeId id, const std::string &name)
sets the name of node id
Exception : the element we looked for cannot be found.
void insert(const Key &k)
Inserts a new element into the set.
Container used to map discrete variables with nodes.
const DiscreteVariable & variableFromName(std::string_view name) const
const DiscreteVariable & get(NodeId id) const
Returns a discrete variable given it's node id.
const std::string & name(NodeId id) const
Returns the name of a variable given its id.
#define GUM_ERROR(type, msg)
Class representing probabilistic DAG model.
Size NodeId
Type for node ids.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
gum is the global namespace for all aGrUM entities
Set< const DiscreteVariable * > VariableSet