34 #endif // GUM_NOINLINE 38 __model(m), __node(id) {
82 if (
size() != other.
size())
return false;
86 for (
const auto& nid :
nodes()) {
92 for (
const auto& arc :
arcs()) {
103 std::stringstream output;
104 std::stringstream nodeStream;
105 std::stringstream arcStream;
107 output <<
"digraph \"" 108 <<
"no_name\" {" << std::endl;
109 nodeStream <<
"node [shape = ellipse];" << std::endl;
110 std::string tab =
" ";
115 if (node ==
__node) { nodeStream <<
", color=red"; }
116 nodeStream <<
"];" << std::endl;
119 arcStream << tab << node <<
" -> " << chi;
121 arcStream <<
";" << std::endl;
125 output << nodeStream.str() << std::endl
126 << arcStream.str() << std::endl
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
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
Size sizeArcs() const
wrapping DiGraph::sizeArcs()
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
void __buildMarkovBlanket()
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size sizeArcs() const
Returns the number of arcs in this Directed Graphical Model.
MarkovBlanket(const DAGmodel &m, NodeId n)
bool exists(const NodeId id) const
alias for existsNode
Generic doubly linked lists.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Class building the markov Blanket from a BN and a nodeName.
std::string toDot() const
Size size() const
wrapping DiGraph::size()
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
bool hasSameStructure(const DAGmodel &other)
Size size() const
Returns the number of variables in this Directed Graphical Model.
const ArcSet & arcs() const
wrapping DiGraph::arcs()
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variabe given it's node id.
bool existsNode(const NodeId id) const
returns true iff the NodeGraphPart contains the given nodeId
const NodeSet & children(const NodeId id) const
returns the set of nodes with arc outgoing from a given node
const std::string & name() const
returns the name of the variable
bool existsArc(const Arc &arc) const
indicates whether a given arc exists
Size NodeId
Type for node ids.
void insert(const Key &k)
Inserts a new element into the set.
#define GUM_ERROR(type, msg)
const NodeGraphPart & nodes() const
wrapping DiGraph::nodes()