34 #endif // GUM_NOINLINE 38 __model(m), __node(id) {
49 bool anythingnew =
false;
54 if (!anythingnew)
break;
71 const std::string& name,
116 if (
size() != other.
size())
return false;
120 for (
const auto& nid:
nodes()) {
123 }
catch (
NotFound) {
return false; }
126 for (
const auto& arc:
arcs()) {
137 std::stringstream output;
138 std::stringstream nodeStream;
139 std::stringstream arcStream;
141 output <<
"digraph \"" 142 <<
"no_name\" {" << std::endl;
143 nodeStream <<
"node [shape = ellipse];" << std::endl;
144 std::string tab =
" ";
149 if (node ==
__node) { nodeStream <<
", color=red"; }
150 nodeStream <<
"];" << std::endl;
153 arcStream << tab << node <<
" -> " << chi;
155 arcStream <<
";" << std::endl;
159 output << nodeStream.str() << std::endl
160 << 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 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 DAG::sizeArcs()
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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.
bool exists(const NodeId id) const
alias for existsNode
Generic doubly linked lists.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Class building the markov Blanket from a BN and a nodeName.
bool __buildMarkovBlanket(const NodeId id)
std::string toDot() const
Size size() const
wrapping DAG::size()
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
bool hasSameStructure(const DAGmodel &other)
const ArcSet & arcs() const
wrapping DAG::arcs()
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
MarkovBlanket(const DAGmodel &m, NodeId n, int level=1)
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
NodeSet asNodeSet() const
returns a copy of the set of nodes represented by the NodeGraphPart
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it's node id.
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
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 DAG::nodes()