34 #endif // GUM_NOINLINE 74 for (
const auto& arc : v) {
78 }
while (v.size() > 0);
92 if (c == a) {
continue; }
105 for (
const auto& i : cs) {
107 if (ss.
size() < 2) {
return false; }
114 std::stringstream output;
115 std::stringstream nodeStream;
116 std::stringstream edgeStream;
118 output <<
"digraph \"" 119 <<
"no_name\" {" << std::endl;
120 nodeStream <<
"node [shape = ellipse];" << std::endl;
121 std::string tab =
" ";
124 nodeStream << tab << node <<
"[label=\"" 128 if (!treatedNodes.
exists(nei))
129 edgeStream << tab << node <<
" -> " << nei <<
" [dir=none];" 133 edgeStream << tab << node <<
" -> " << chi <<
" [color=red];" 136 treatedNodes.
insert(node);
139 output << nodeStream.str() << std::endl
140 << edgeStream.str() << std::endl
148 for (
const auto& n :
nodes())
150 for (
const auto& edge :
edges())
151 skel.
addEdge(edge.first(), edge.second());
152 for (
const auto& arc :
arcs())
153 skel.
addEdge(arc.tail(), arc.head());
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Virtual base class for PGMs using a DAG.
const NodeGraphPart & nodes() const
wrapping MixedGraph::nodes()
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool __strongly_protected(NodeId a, NodeId b)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
UndiGraph skeleton() const
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 EdgeSet & edges() const
wrapping MixedGraph::edges()
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.
Base class for undirected graphs.
Size size() const noexcept
Returns the number of elements in the set.
const std::string & name() const
returns the name of the variable
const ArcSet & arcs() const
wrapping MixedGraph::arcs()
Size NodeId
Type for node ids.
void insert(const Key &k)
Inserts a new element into the set.
Base class for mixed graphs.