31 #endif // GUM_NOINLINE 71 for (
const auto& arc : v) {
75 }
while (v.size() > 0);
89 if (c == a) {
continue; }
102 for (
const auto& i : cs) {
104 if (ss.
size() < 2) {
return false; }
111 std::stringstream output;
112 std::stringstream nodeStream;
113 std::stringstream edgeStream;
115 output <<
"digraph \"" 116 <<
"no_name\" {" << std::endl;
117 nodeStream <<
"node [shape = ellipse];" << std::endl;
118 std::string tab =
" ";
121 nodeStream << tab << node <<
"[label=\"" 125 if (!treatedNodes.
exists(nei))
126 edgeStream << tab << node <<
" -> " << nei <<
" [dir=none];" 130 edgeStream << tab << node <<
" -> " << chi <<
" [color=red];" 133 treatedNodes.
insert(node);
136 output << nodeStream.str() << std::endl
137 << edgeStream.str() << std::endl
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
virtual void clear()
removes all the nodes, arcs and edges from the graph
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
Inline implementation of the class building the essential Graph from a DAGmodel.
Virtual base class for PGMs using a DAG.
EssentialGraph & operator=(const EssentialGraph &g)
virtual void eraseArc(const Arc &arc)
removes an arc from the ArcGraphPart
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
std::string toDot() const
Generic doubly linked lists.
gum is the global namespace for all aGrUM entities
bool __strongly_protected(NodeId a, NodeId b)
Class building the essential Graph from a DAGmodel.
const NodeSet & neighbours(const NodeId id) const
returns the set of edges adjacent to a given node
Size size() const
wrapping MixedGraph::size()
const DAGmodel * __dagmodel
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...
void __buildEssentialGraph()
bool existsEdge(const Edge &edge) const
indicates whether a given edge exists
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
const NodeGraphPart & nodes() const
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
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 exists(const Val &val) const
Checks whether there exists a given element in the list.
Val & insert(const Val &val)
Inserts a new element at the end of the chained list (alias of pushBack).
const NodeSet & children(const NodeId id) const
returns the set of nodes with arc outgoing from a given node
Class building the essential graph from a BN.
Size size() const noexcept
Returns the number of elements in the set.
const std::string & name() const
returns the name of the variable
Size NodeId
Type for node ids.
void insert(const Key &k)
Inserts a new element into the set.
Base class for mixed graphs.