aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRMClassElementContainer.h File Reference

Headers of gum::prm::PRMClassElementContainer. More...

Include dependency graph for PRMClassElementContainer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gum::prm::PRMClassElementContainer< GUM_SCALAR >
 <agrum/PRM/classElementContainer.h> More...

Namespaces

namespace  gum
 gum is the global namespace for all aGrUM entities
namespace  gum::prm
 namespace for all probabilistic relational models entities

Functions

template<typename GUM_SCALAR>
std::ostream & operator<< (std::ostream &output, const gum::prm::PRMClassElementContainer< GUM_SCALAR > &container)
 An << operator for PRMClassElementContainer. Output in the graphviz-dot format.

Detailed Description

Headers of gum::prm::PRMClassElementContainer.

Author
Lionel TORTI and Pierre-Henri WUILLEMIN(_at_LIP6)

Definition in file PRMClassElementContainer.h.

Function Documentation

◆ operator<<()

template<typename GUM_SCALAR>
std::ostream & operator<< ( std::ostream & output,
const gum::prm::PRMClassElementContainer< GUM_SCALAR > & container )

An << operator for PRMClassElementContainer. Output in the graphviz-dot format.

Definition at line 206 of file PRMClassElementContainer_tpl.h.

207 {
208 std::string tab = " ";
209 output << "digraph \"" << container.name() << "\" {" << std::endl;
210
211 for (const auto node: container.containerDag().nodes()) {
212 if (container.containerDag().children(node).size() > 0) {
213 for (const auto chi: container.containerDag().children(node)) {
214 output << tab << "\"" << container.get(node).name() << "\" -> "
215 << "\"" << container.get(chi).name() << "\";" << std::endl;
216 }
217 } else if (container.containerDag().parents(node).size() == 0) {
218 output << tab << "\"" << container.get(node).name() << "\";" << std::endl;
219 }
220 }
221
222 output << "}" << std::endl;
223 return output;
224}
const NodeSet & parents(NodeId id) const
returns the set of nodes with arc ingoing to a given node
NodeSet children(const NodeSet &ids) const
returns the set of children of a set of nodes
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
Size size() const noexcept
Returns the number of elements in the set.
Definition set_tpl.h:636
virtual PRMClassElement< GUM_SCALAR > & get(const std::string &name)=0
Getter on a member of this PRMClassElementContainer.
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.
const std::string & name() const
Returns the name of this object.