29 #ifndef GUM_DAGMODEL_H 30 #define GUM_DAGMODEL_H 32 #include <agrum/agrum.h> 33 #include <agrum/tools/multidim/instantiation.h> 34 #include <agrum/tools/graphicalModels/graphicalModel.h> 36 #include <agrum/tools/graphs/DAG.h> 37 #include <agrum/tools/graphs/undiGraph.h> 91 bool exists(NodeId node)
const final;
106 bool existsArc(
const NodeId tail,
const NodeId head)
const;
107 bool existsArc(
const std::string& nametail,
const std::string& namehead)
const;
179 bool isIndependent(NodeId X, NodeId Y,
const NodeSet& Z)
const final;
183 bool isIndependent(
const NodeSet& X,
const NodeSet& Y,
const NodeSet& Z)
const final;
186 const std::string& Yname,
187 const std::vector< std::string >& Znames)
const {
188 return isIndependent(idFromName(Xname), idFromName(Yname), nodeset(Znames));
192 const std::vector< std::string >& Ynames,
193 const std::vector< std::string >& Znames)
const {
194 return isIndependent(nodeset(Xnames), nodeset(Ynames), nodeset(Znames));
234 #ifndef GUM_NO_INLINE 235 # include <agrum/tools/graphicalModels/DAGmodel_inl.h> DAGmodel & operator=(const DAGmodel &source)
Private copy operator.
const ArcSet & arcs() const
return true if the arc tail->head exists in the DAGmodel
Virtual base class for PGMs using a DAG.
const NodeSet & children(const NodeId id) const
returns the set of nodes with arc outgoing from a given node
UndiGraph moralizedAncestralGraph(const std::vector< std::string > &nodenames) const
build a UndiGraph by moralizing the Ancestral Graph of a set of Nodes
NodeSet ancestors(const NodeId id) const
returns the set of nodes with directed path ingoing to a given node
NodeSet descendants(const NodeId id) const
returns the set of nodes with directed path outgoing from a given node
const NodeGraphPart & nodes() const final
Returns a constant reference to the dag of this Bayes Net.
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
INLINE void emplace(Args &&... args)
Size sizeArcs() const
Returns the number of arcs in this Directed Graphical Model.
virtual Size size() const final
Returns the number of variables in this Directed Graphical Model.
virtual ~DAGmodel()
Destructor.
NodeSet ancestors(const std::string &name) const
return true if the arc tail->head exists in the DAGmodel
NodeSet descendants(const std::string &name) const
return true if the arc tail->head exists in the DAGmodel
void _moralGraph_() const
Returns the moral graph of this DAGModel.
bool existsArc(const NodeId tail, const NodeId head) const
return true if the arc tail->head exists in the DAGmodel
bool hasSameStructure(const DAGmodel &other)
DAGmodel()
Default constructor.
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
NodeSet family(const NodeId id) const
returns the parents of a node and the node
DAGmodel(const DAGmodel &source)
Copy constructor.
NodeSet family(const std::string &name) const
return true if the arc tail->head exists in the DAGmodel
DAG dag_
The DAG of this Directed Graphical Model.
NodeSet children(const std::vector< std::string > &names) const
return true if the arc tail->head exists in the DAGmodel
const UndiGraph & moralGraph(bool clear=true) const
The node's id are coherent with the variables and nodes of the topology.
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 topol...
NodeSet parents(const std::vector< std::string > &names) const
return true if the arc tail->head exists in the DAGmodel
bool isIndependent(NodeId X, NodeId Y, const NodeSet &Z) const final
check if node X and node Y are independent given nodes Z
UndiGraph * _mutableMoralGraph_
The moral graph of this Directed Graphical Model.
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
bool exists(NodeId node) const final
Return true if this node exists in this graphical model.
bool existsArc(const std::string &nametail, const std::string &namehead) const
return true if the arc tail->head exists in the DAGmodel