![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Portion of a BN identified by the list of nodes and a BayesNet. More...
#include <agrum/BN/BayesNetFragment.h>
Public Member Functions | |
gum::BayesNet< GUM_SCALAR > | toBN () const |
create a brand new BayesNet from a fragment. More... | |
bool | operator== (const IBayesNet< GUM_SCALAR > &from) const |
This operator compares 2 BNs ! More... | |
bool | operator!= (const IBayesNet< GUM_SCALAR > &from) const |
Size | dim () const |
Returns the dimension (the number of free parameters) in this bayes net. More... | |
Size | maxVarDomainSize () const |
GUM_SCALAR | minParam () const |
GUM_SCALAR | maxParam () const |
GUM_SCALAR | minNonZeroParam () const |
GUM_SCALAR | maxNonOneParam () const |
std::string | toString () const |
NodeSet | minimalCondSet (NodeId target, const NodeSet &soids) const |
NodeSet | minimalCondSet (const NodeSet &targets, const NodeSet &soids) const |
bool | hasSameStructure (const DAGmodel &other) |
double | log10DomainSize () const |
void | _attachSignal_ (__sig__::ISignaler *sender) |
void | _detachSignal_ (__sig__::ISignaler *sender) |
Constructors / Destructors | |
BayesNetFragment ()=delete | |
BayesNetFragment (const BayesNetFragment< GUM_SCALAR > &fragment)=delete | |
BayesNetFragment (BayesNetFragment< GUM_SCALAR > &&fragment)=delete | |
BayesNetFragment (const IBayesNet< GUM_SCALAR > &bn) | |
virtual | ~BayesNetFragment () |
signals | |
virtual void | whenNodeAdded (const void *src, NodeId id) final |
the action to take when a new node is inserted into the graph More... | |
virtual void | whenNodeDeleted (const void *src, NodeId id) final |
the action to take when a node has just been removed from the graph More... | |
virtual void | whenArcAdded (const void *src, NodeId from, NodeId to) final |
the action to take when a new arc is inserted into the graph More... | |
virtual void | whenArcDeleted (const void *src, NodeId from, NodeId to) final |
the action to take when an arc has just been removed from the graph More... | |
IBayesNet interface | |
const Potential< GUM_SCALAR > & | cpt (NodeId varId) const final |
Returns the CPT of a variable. More... | |
const Potential< GUM_SCALAR > & | cpt (const std::string &name) const |
Returns the CPT of a variable. More... | |
const VariableNodeMap & | variableNodeMap () const final |
Returns a constant reference to the VariableNodeMap of this BN. More... | |
virtual const DiscreteVariable & | variable (NodeId id) const final |
Returns a constant reference over a variabe given it's node id. More... | |
virtual const DiscreteVariable & | variable (const std::string &name) const final |
Returns the CPT of a variable. More... | |
virtual NodeId | nodeId (const DiscreteVariable &var) const final |
Return id node from discrete var pointer. More... | |
virtual NodeId | idFromName (const std::string &name) const final |
Getter by name. More... | |
virtual const DiscreteVariable & | variableFromName (const std::string &name) const final |
Getter by name. More... | |
virtual std::string | toDot () const final |
creates a dot representing the whole referred BN hilighting the fragment. More... | |
API for Fragment | |
bool | isInstalledNode (NodeId id) const |
check if a certain NodeId exists in the fragment More... | |
bool | isInstalledNode (const std::string &name) const |
check if a certain NodeId exists in the fragment More... | |
void | installNode (NodeId id) |
install a node referenced by its nodeId More... | |
void | installNode (const std::string &name) |
check if a certain NodeId exists in the fragment More... | |
void | installAscendants (NodeId id) |
install a node and all its ascendants More... | |
void | installAscendants (const std::string &name) |
check if a certain NodeId exists in the fragment More... | |
void | uninstallNode (NodeId id) |
uninstall a node referenced by its nodeId More... | |
void | uninstallNode (const std::string &name) |
check if a certain NodeId exists in the fragment More... | |
void | installMarginal (NodeId id, const Potential< GUM_SCALAR > &pot) |
install a local marginal BY COPY for a node into the fragment. More... | |
void | installMarginal (const std::string &name, const Potential< GUM_SCALAR > &pot) |
check if a certain NodeId exists in the fragment More... | |
void | installCPT (NodeId id, const Potential< GUM_SCALAR > &pot) |
install a local cpt BY COPYfor a node into the fragment. More... | |
void | installCPT (const std::string &name, const Potential< GUM_SCALAR > &pot) |
check if a certain NodeId exists in the fragment More... | |
void | uninstallCPT (NodeId id) |
uninstall a local CPT. More... | |
void | uninstallCPT (const std::string &name) |
check if a certain NodeId exists in the fragment More... | |
bool | checkConsistency (NodeId id) const |
returns true if the nodeId's (local or not) cpt is consistent with its parents in the fragment More... | |
bool | checkConsistency (const std::string &name) const |
check if a certain NodeId exists in the fragment More... | |
bool | checkConsistency () const |
returns true if all nodes in the fragment are consistent More... | |
Joint Probability manipulation methods | |
GUM_SCALAR | jointProbability (const Instantiation &i) const |
Compute a parameter of the joint probability for the BN (given an instantiation of the vars) More... | |
GUM_SCALAR | log2JointProbability (const Instantiation &i) const |
Compute a parameter of the log joint probability for the BN (given an instantiation of the vars) More... | |
Variable manipulation methods. | |
const DAG & | dag () 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 | sizeArcs () 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... | |
Variable manipulation methods. | |
bool | exists (const std::string &name) const |
Return true if this graphical model is empty. More... | |
virtual bool | empty () 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... | |
Arc manipulation methods. | |
const ArcSet & | arcs () const |
return true if the arc tail->head exists in the DAGmodel More... | |
bool | existsArc (const NodeId tail, const NodeId head) const |
return true if the arc tail->head exists in the DAGmodel More... | |
bool | existsArc (const std::string &nametail, const std::string &namehead) const |
return true if the arc tail->head exists in the DAGmodel More... | |
const NodeSet & | parents (const NodeId id) const |
returns the set of nodes with arc ingoing to a given node More... | |
const NodeSet & | parents (const std::string &name) const |
return true if the arc tail->head exists in the DAGmodel More... | |
NodeSet | parents (const NodeSet &ids) const |
returns the parents of a set of nodes More... | |
NodeSet | parents (const std::vector< std::string > &names) const |
return true if the arc tail->head exists in the DAGmodel More... | |
NodeSet | family (const NodeId id) const |
returns the parents of a node and the node More... | |
NodeSet | family (const std::string &name) const |
return true if the arc tail->head exists in the DAGmodel More... | |
const NodeSet & | children (const NodeId id) const |
returns the set of nodes with arc outgoing from a given node More... | |
const NodeSet & | children (const std::string &name) const |
return true if the arc tail->head exists in the DAGmodel More... | |
NodeSet | children (const NodeSet &ids) const |
returns the children of a set of nodes More... | |
NodeSet | children (const std::vector< std::string > &names) const |
return true if the arc tail->head exists in the DAGmodel More... | |
NodeSet | descendants (const NodeId id) const |
returns the set of nodes with directed path outgoing from a given node More... | |
NodeSet | descendants (const std::string &name) const |
return true if the arc tail->head exists in the DAGmodel More... | |
NodeSet | ancestors (const NodeId id) const |
returns the set of nodes with directed path ingoing to a given node More... | |
NodeSet | ancestors (const std::string &name) const |
return true if the arc tail->head exists in the DAGmodel More... | |
Graphical methods | |
UndiGraph | moralizedAncestralGraph (const NodeSet &nodes) const |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes More... | |
UndiGraph | moralizedAncestralGraph (const std::vector< std::string > &nodenames) const |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes More... | |
bool | isIndependent (NodeId X, NodeId Y, const NodeSet &Z) const final |
check if node X and node Y are independent given nodes 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 |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes More... | |
bool | isIndependent (const std::vector< std::string > &Xnames, const std::vector< std::string > &Ynames, const std::vector< std::string > &Znames) const |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes More... | |
const UndiGraph & | moralGraph (bool clear=true) const |
The node's id are coherent with the variables and nodes of the topology. More... | |
const Sequence< NodeId > & | topologicalOrder (bool clear=true) const |
The topological order stays the same as long as no variable or arcs are added or erased src the topology. 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... | |
Protected Attributes | |
DAG | dag_ |
The DAG of this Directed Graphical Model. More... | |
DiGraph * | graph_ |
the graph to listen to More... | |
Protected Member Functions | |
void | uninstallArc_ (NodeId from, NodeId to) |
void | installArc_ (NodeId from, NodeId to) |
void | installCPT_ (NodeId id, const Potential< GUM_SCALAR > &pot) |
void | uninstallCPT_ (NodeId id) |
uninstall a local CPT. More... | |
Portion of a BN identified by the list of nodes and a BayesNet.
This class is a decorator of a BayesNet implementing the IBayesNet interface. CPTs can be shared with the BN or can be specific to the Fragment if different.
BayesNetFragment is a DiGraphListener in order to be synchronized (especially when removing nodes or arcs).
In a BayesNetFragment, one can install or remove nodes. An arc can be in the fragment if and only if its head and tail are installed in the fragment. *When installing a node, all the arcs that can be added in the fragment are *effectively installed (resp. *when uninstalling a node, etc.).
A BayesNetFragment can redefine potential for node. The main reason is to be able to install a node without installing all its parents (and its ascendants). So local CPT to the node can be installed. However, it is not done automatically.
If a cpt is not locally defined, the fragment uses the cpt defined in the referred BN. The checkConsistency() method verifies that, for all installed nodes, either all the parents are installed or a local CPT is defined.
Definition at line 72 of file BayesNetFragment.h.
|
delete |
|
delete |
|
delete |
|
explicit |
Definition at line 34 of file BayesNetFragment_tpl.h.
|
virtual |
Definition at line 40 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Definition at line 35 of file listener_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Definition at line 37 of file listener_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with directed path ingoing to a given node
Note that the set of nodes returned may be empty if no path within the ArcGraphPart is ingoing to the given node.
id | the node which is the head of a directed path with the returned nodes |
name | the name of the node which is the head of a directed path with the returned nodes |
Definition at line 96 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 98 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 43 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
bool gum::BayesNetFragment< GUM_SCALAR >::checkConsistency | ( | NodeId | id | ) | const |
returns true if the nodeId's (local or not) cpt is consistent with its parents in the fragment
NotFound | if the id is not in the fragment |
Definition at line 260 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 262 of file BayesNetFragment.h.
INLINE bool gum::BayesNetFragment< GUM_SCALAR >::checkConsistency | ( | ) | const |
returns true if all nodes in the fragment are consistent
gum::OperatioNotAllowed | if the fragment is not consistent. |
Definition at line 275 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with arc outgoing from a given node
Note that the set of nodes returned may be empty if no node is outgoing from the given node.
id | the node which is the tail of an arc with the returned nodes |
name | the name of the node which is the tail of an arc with the returned nodes |
Definition at line 65 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 66 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the children of a set of nodes
Definition at line 70 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 72 of file DAGmodel_inl.h.
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.
|
finalvirtual |
Returns the CPT of a variable.
NotFound | If no variable's id matches varId. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 72 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
Returns the CPT of a variable.
NotFound | If no variable's id matches varId. |
Definition at line 128 of file BayesNetFragment.h.
|
inherited |
Returns a constant reference to the dag of this Bayes Net.
Definition at line 35 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with directed path outgoing from a given node
Note that the set of nodes returned may be empty if no path within the ArcGraphPart is outgoing from the given node.
id | the node which is the tail of a directed path with the returned nodes |
name | the name of the node which is the tail of a directed path with the returned nodes |
Definition at line 90 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 92 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns the dimension (the number of free parameters) in this bayes net.
\( dim(G)=\sum_{i \in nodes} ((r_i-1)\cdot q_i) \) where \( r_i \) is the number of instantiations of node \( i \) and \( q_i \) is the number of instantiations of its parents.
Definition at line 78 of file IBayesNet_tpl.h.
|
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 82 of file DAGmodel_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 arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 45 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 49 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the parents of a node and the node
Note that the set of nodes returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node which is the head of an arc with the returned nodes |
name | the name of the node the node which is the head of an arc with the returned nodes |
Definition at line 59 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 61 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
Definition at line 69 of file DAGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
Getter by name.
NotFound | if no such name exists in the graph. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 103 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
transform a vector of names into a vector of nodeId
Definition at line 117 of file graphicalModel_inl.h.
|
protected |
Definition at line 170 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::BayesNetFragment< GUM_SCALAR >::installAscendants | ( | NodeId | id | ) |
install a node and all its ascendants
NotFound | if the node does not exist in the referred BN |
Definition at line 148 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 203 of file BayesNetFragment.h.
void gum::BayesNetFragment< GUM_SCALAR >::installCPT | ( | NodeId | id, |
const Potential< GUM_SCALAR > & | pot | ||
) |
install a local cpt BY COPYfor a node into the fragment.
This function will change the arcs from the parents to the node in order to be consistent with the new local potential.
id | the nodeId |
pot | the potential to be copied |
NotFound | if the id is not in the fragment |
OperationNotAllowed | if the potential is not compliant with the variable or if a variable in the CPT is not a parent in the referred bn. |
Definition at line 195 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 241 of file BayesNetFragment.h.
|
protected |
Definition at line 175 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
void gum::BayesNetFragment< GUM_SCALAR >::installMarginal | ( | NodeId | id, |
const Potential< GUM_SCALAR > & | pot | ||
) |
install a local marginal BY COPY for a node into the fragment.
This function will remove all the arcs from the parents to the node.
id | the nodeId |
pot | the potential |
NotFound | if the id is not in the fragment |
OperationNotAllowed | if the potential is not compliant with the variable (or is not a marginal) |
Definition at line 240 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 224 of file BayesNetFragment.h.
void gum::BayesNetFragment< GUM_SCALAR >::installNode | ( | NodeId | id | ) |
install a node referenced by its nodeId
NotFound | if the node does not exist in the referred BN |
Definition at line 129 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 194 of file BayesNetFragment.h.
|
finalvirtualinherited |
check if node X and node Y are independent given nodes Z
Implements gum::GraphicalModel.
Definition at line 113 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
check if nodes X and nodes Y are independent given nodes Z
Implements gum::GraphicalModel.
Definition at line 117 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlineinherited |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes
nodes | the set of nodeId |
nodenames | the vector of names of nodes |
Definition at line 185 of file DAGmodel.h.
|
inlineinherited |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes
nodes | the set of nodeId |
nodenames | the vector of names of nodes |
Definition at line 191 of file DAGmodel.h.
INLINE bool gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode | ( | NodeId | id | ) | const |
check if a certain NodeId exists in the fragment
Definition at line 124 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 183 of file BayesNetFragment.h.
|
inherited |
Compute a parameter of the joint probability for the BN (given an instantiation of the vars)
Definition at line 207 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 73 of file graphicalModel_inl.h.
|
inherited |
Compute a parameter of the log joint probability for the BN (given an instantiation of the vars)
Compute a parameter of the joint probability for the BN (given an instantiation of the vars)
Definition at line 225 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 134 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 114 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 94 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 332 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 349 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 124 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 104 of file IBayesNet_tpl.h.
The node's id are coherent with the variables and nodes of the topology.
clear | If false returns the previously created moral graph. |
Definition at line 55 of file DAGmodel.cpp.
References gum::Set< Key, Alloc >::emplace().
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes
nodes | the set of nodeId |
nodenames | the vector of names of nodes |
Definition at line 109 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes
nodes | the set of nodeId |
nodenames | the vector of names of nodes |
Definition at line 104 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
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.
|
finalvirtual |
Return id node from discrete var pointer.
NotFound | If no variable matches var. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 94 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
Returns a constant reference to the dag of this Bayes Net.
Implements gum::GraphicalModel.
Definition at line 84 of file DAGmodel_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().
|
inherited |
Definition at line 286 of file IBayesNet_tpl.h.
|
inherited |
This operator compares 2 BNs !
Definition at line 242 of file IBayesNet_tpl.h.
returns the set of nodes with arc ingoing to a given node
Note that the set of nodes returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node which is the head of an arc with the returned nodes |
name | the name of the node the node which is the head of an arc with the returned nodes |
Definition at line 53 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 55 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the parents of a set of nodes
Definition at line 76 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return true if the arc tail->head exists in the DAGmodel
tail | the nodeId (or the name) of the tail in tail->head |
head | the nodeId (or the name) of the head in tail->head |
Definition at line 78 of file DAGmodel_inl.h.
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.
|
finalvirtualinherited |
Returns the number of variables in this Directed Graphical Model.
Implements gum::GraphicalModel.
Definition at line 38 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns the number of arcs in this Directed Graphical Model.
Definition at line 41 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
gum::BayesNet< GUM_SCALAR > gum::BayesNetFragment< GUM_SCALAR >::toBN | ( | ) | const |
create a brand new BayesNet from a fragment.
Definition at line 355 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
creates a dot representing the whole referred BN hilighting the fragment.
Reimplemented from gum::IBayesNet< GUM_SCALAR >.
Definition at line 283 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
The topological order stays the same as long as no variable or arcs are added or erased src the topology.
clear | If false returns the previously created topology. |
Definition at line 86 of file DAGmodel_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Definition at line 144 of file IBayesNet_tpl.h.
|
protected |
Definition at line 165 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT | ( | NodeId | id | ) |
uninstall a local CPT.
Definition at line 224 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 253 of file BayesNetFragment.h.
|
protected |
uninstall a local CPT.
Does nothing if no local CPT for this nodeId No check. No change in the topology. Checks are made in public methods.
Definition at line 218 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::BayesNetFragment< GUM_SCALAR >::uninstallNode | ( | NodeId | id | ) |
uninstall a node referenced by its nodeId
Definition at line 157 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
check if a certain NodeId exists in the fragment
Definition at line 211 of file BayesNetFragment.h.
|
finalvirtual |
Returns a constant reference over a variabe given it's node id.
NotFound | If no variable's id matches varId. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 87 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinefinalvirtual |
Returns the CPT of a variable.
NotFound | If no variable's id matches varId. |
Definition at line 143 of file BayesNetFragment.h.
|
finalvirtual |
Getter by name.
NotFound | if no such name exists in the graph. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 113 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
Returns a constant reference to the VariableNodeMap of this BN.
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 82 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
the action to take when a new arc is inserted into the graph
src | the object that sent the signal |
from | the id of tail of the new arc inserted into the graph |
to | the id of head of the new arc inserted into the graph |
Implements gum::DiGraphListener.
Definition at line 59 of file BayesNetFragment_tpl.h.
|
finalvirtual |
the action to take when an arc has just been removed from the graph
src | the object that sent the signal |
from | the id of tail of the arc removed from the graph |
to | the id of head of the arc removed from the graph |
Implements gum::DiGraphListener.
Definition at line 64 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
the action to take when a new node is inserted into the graph
src | the object that sent the signal |
id | the id of the new node inserted into the graph |
Implements gum::DiGraphListener.
Definition at line 50 of file BayesNetFragment_tpl.h.
|
finalvirtual |
the action to take when a node has just been removed from the graph
src | the object that sent the signal |
id | the id of the node has just been removed from the graph |
Implements gum::DiGraphListener.
Definition at line 54 of file BayesNetFragment_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
The referred BayesNet.
Definition at line 75 of file BayesNetFragment.h.
|
private |
Mapping between the variable's id and their CPT specific to this Fragment.
Definition at line 79 of file BayesNetFragment.h.
|
protectedinherited |
The DAG of this Directed Graphical Model.
Definition at line 222 of file DAGmodel.h.
|
protectedinherited |
the graph to listen to
Definition at line 98 of file diGraphListener.h.