31 #endif // GUM_NOINLINE 35 __model(m), __node(id) {
79 if (
size() != other.
size())
return false;
83 for (
const auto& nid :
nodes()) {
89 for (
const auto& arc :
arcs()) {
100 std::stringstream output;
101 std::stringstream nodeStream;
102 std::stringstream arcStream;
104 output <<
"digraph \"" 105 <<
"no_name\" {" << std::endl;
106 nodeStream <<
"node [shape = ellipse];" << std::endl;
107 std::string tab =
" ";
112 if (node ==
__node) { nodeStream <<
", color=red"; }
113 nodeStream <<
"];" << std::endl;
116 arcStream << tab << node <<
" -> " << chi;
118 arcStream <<
";" << std::endl;
122 output << nodeStream.str() << std::endl
123 << 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()
Inline implementation of the class building the essential Graph from a DAGmodel.
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.
gum is the global namespace for all aGrUM entities
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...
Class building the markovBlanket from a DAGmodel and a node name.
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()