![]() |
aGrUM
0.21.0
a C++ library for (probabilistic) graphical models
|
Virtual base class for PGMs using a undirected graph. More...
#include <agrum/tools/graphicalModels/UGmodel.h>
Public Member Functions | |
bool | hasSameStructure (const UGmodel &other) |
check if nodes X and nodes Y are independent given nodes Z More... | |
double | log10DomainSize () const |
Constructors / Destructors | |
UGmodel () | |
Default constructor. More... | |
virtual | ~UGmodel () |
Destructor. More... | |
UGmodel (const UGmodel &source) | |
Copy constructor. More... | |
Variable manipulation methods. | |
const UndiGraph & | graph () const |
Returns a constant reference to the dag of this Bayes Net. More... | |
virtual Size | size () const final |
Returns the number of variables in this Directed Graphical Model. More... | |
Size | sizeEdges () const |
Returns the number of arcs in this Directed Graphical Model. More... | |
const NodeGraphPart & | nodes () const final |
Returns a constant reference to the dag of this Bayes Net. More... | |
bool | exists (NodeId node) const final |
Return true if this node exists in this graphical model. More... | |
Edge manipulation methods. | |
const EdgeSet & | edges () const |
return true if the edge node1-node2 exists in the UGModel More... | |
bool | existsEdge (const NodeId node1, const NodeId node2) const |
return true if the edge node1-node2 exists in the UGModel More... | |
bool | existsEdge (const std::string &name1, const std::string &name2) const |
return true if the edge node1-node2 exists in the UGModel More... | |
const NodeSet & | neighbours (const NodeId id) const |
returns the neighbours of a node as set of nodes More... | |
const NodeSet & | neighbours (const std::string &name) const |
return true if the edge node1-node2 exists in the UGModel More... | |
virtual bool | isIndependent (NodeId X, NodeId Y, const NodeSet &Z) const final |
check if X and Y are independent given Z More... | |
bool | isIndependent (const NodeSet &X, const NodeSet &Y, const NodeSet &Z) const final |
check if nodes X and nodes Y are independent given nodes Z More... | |
bool | isIndependent (const std::string &Xname, const std::string &Yname, const std::vector< std::string > &Znames) const |
return true if the edge node1-node2 exists in the UGModel More... | |
bool | isIndependent (const std::vector< std::string > &Xnames, const std::vector< std::string > &Ynames, const std::vector< std::string > &Znames) const |
return true if the edge node1-node2 exists in the UGModel More... | |
Getter and setters | |
const std::string & | property (const std::string &name) const |
Return the value of the property name of this GraphicalModel. More... | |
const std::string & | propertyWithDefault (const std::string &name, const std::string &byDefault) const |
Return the value of the property name of this GraphicalModel. More... | |
void | setProperty (const std::string &name, const std::string &value) |
Add or change a property of this GraphicalModel. More... | |
Variable manipulation methods. | |
virtual const VariableNodeMap & | variableNodeMap () const =0 |
Returns a constant reference to the VariableNodeMap of this Graphical Model. More... | |
virtual bool | empty () const |
Return true if this graphical model is empty. More... | |
bool | exists (const std::string &name) const |
Return true if this graphical model is empty. More... | |
std::vector< std::string > | names (const std::vector< NodeId > &ids) const |
transform a vector of NodeId in a vector of names More... | |
std::vector< std::string > | names (const NodeSet &ids) const |
transform a NodeSet in a vector of names More... | |
std::vector< NodeId > | ids (const std::vector< std::string > &names) const |
transform a vector of names into a vector of nodeId More... | |
NodeSet | nodeset (const std::vector< std::string > &names) const |
transform a vector of names into a NodeSet More... | |
Instantiation | completeInstantiation () const |
Get an instantiation over all the variables of the model. More... | |
virtual const DiscreteVariable & | variable (NodeId id) const =0 |
Returns a constant reference over a variable given it's node id. More... | |
virtual NodeId | nodeId (const DiscreteVariable &var) const =0 |
Return id node src discrete var pointer. More... | |
virtual NodeId | idFromName (const std::string &name) const =0 |
Getter by name. More... | |
virtual const DiscreteVariable & | variableFromName (const std::string &name) const =0 |
Getter by name. More... | |
Protected Attributes | |
UndiGraph | graph_ |
The DAG of this Directed Graphical Model. More... | |
Protected Member Functions | |
UGmodel & | operator= (const UGmodel &source) |
Private copy operator. More... | |
gum::UGmodel::UGmodel | ( | ) |
Default constructor.
Definition at line 29 of file UGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Destructor.
Definition at line 36 of file UGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::UGmodel::UGmodel | ( | const UGmodel & | source | ) |
Copy constructor.
Do nothing.
Definition at line 34 of file UGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Get an instantiation over all the variables of the model.
Definition at line 84 of file graphicalModel_inl.h.
INLINE const EdgeSet & gum::UGmodel::edges | ( | ) | const |
return true if the edge node1-node2 exists in the UGModel
node1 | the nodeId (or the name) of the node1 |
node2 | the nodeId (or the name) of the node2 |
Definition at line 43 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Return true if this graphical model is empty.
Definition at line 94 of file graphicalModel_inl.h.
Return true if this node exists in this graphical model.
Implements gum::GraphicalModel.
Definition at line 58 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlineinherited |
Return true if this graphical model is empty.
Definition at line 112 of file graphicalModel.h.
return true if the edge node1-node2 exists in the UGModel
node1 | the nodeId (or the name) of the node1 |
node2 | the nodeId (or the name) of the node2 |
Definition at line 45 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE bool gum::UGmodel::existsEdge | ( | const std::string & | name1, |
const std::string & | name2 | ||
) | const |
return true if the edge node1-node2 exists in the UGModel
node1 | the nodeId (or the name) of the node1 |
node2 | the nodeId (or the name) of the node2 |
Definition at line 49 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE const UndiGraph & gum::UGmodel::graph | ( | ) | const |
Returns a constant reference to the dag of this Bayes Net.
Definition at line 35 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
check if nodes X and nodes Y are independent given nodes Z
Definition at line 50 of file UGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
pure virtualinherited |
Getter by name.
NotFound | if no such name exists in the graph. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
inherited |
transform a vector of names into a vector of nodeId
Definition at line 117 of file graphicalModel_inl.h.
|
finalvirtual |
check if X and Y are independent given Z
Implements gum::GraphicalModel.
Definition at line 62 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
check if nodes X and nodes Y are independent given nodes Z
Implements gum::GraphicalModel.
Definition at line 66 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
return true if the edge node1-node2 exists in the UGModel
node1 | the nodeId (or the name) of the node1 |
node2 | the nodeId (or the name) of the node2 |
Definition at line 125 of file UGmodel.h.
|
inline |
return true if the edge node1-node2 exists in the UGModel
node1 | the nodeId (or the name) of the node1 |
node2 | the nodeId (or the name) of the node2 |
Definition at line 130 of file UGmodel.h.
|
inherited |
Definition at line 73 of file graphicalModel_inl.h.
|
inherited |
transform a vector of NodeId in a vector of names
Definition at line 97 of file graphicalModel_inl.h.
|
inherited |
transform a NodeSet in a vector of names
Definition at line 107 of file graphicalModel_inl.h.
returns the neighbours of a node as set of nodes
Note that the set of nodes returned may be empty if no edge within the EdgeGraphPart contains the given node.
id | the node toward which the edge returned are pointing |
Definition at line 53 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE const NodeSet & gum::UGmodel::neighbours | ( | const std::string & | name | ) | const |
return true if the edge node1-node2 exists in the UGModel
node1 | the nodeId (or the name) of the node1 |
node2 | the nodeId (or the name) of the node2 |
Definition at line 54 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
pure virtualinherited |
Return id node src discrete var pointer.
NotFound | If no variable matches var. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
finalvirtual |
Returns a constant reference to the dag of this Bayes Net.
Implements gum::GraphicalModel.
Definition at line 60 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
transform a vector of names into a NodeSet
Definition at line 58 of file graphicalModel.cpp.
References gum::Set< Key, Alloc >::emplace().
Private copy operator.
Definition at line 41 of file UGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Return the value of the property name of this GraphicalModel.
NotFound | Raised if no name property is found. |
Definition at line 38 of file graphicalModel_inl.h.
|
inherited |
Return the value of the property name of this GraphicalModel.
return byDefault if the property name is not found
Definition at line 57 of file graphicalModel_inl.h.
|
inherited |
Add or change a property of this GraphicalModel.
Definition at line 65 of file graphicalModel_inl.h.
|
finalvirtual |
Returns the number of variables in this Directed Graphical Model.
Implements gum::GraphicalModel.
Definition at line 38 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Size gum::UGmodel::sizeEdges | ( | ) | const |
Returns the number of arcs in this Directed Graphical Model.
Definition at line 41 of file UGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
pure virtualinherited |
Returns a constant reference over a variable given it's node id.
NotFound | If no variable's id matches varId. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
pure virtualinherited |
Getter by name.
NotFound | if no such name exists in the graph. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
pure virtualinherited |
Returns a constant reference to the VariableNodeMap of this Graphical Model.
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
protected |