35 template <
typename GUM_SCALAR >
39 for (
const auto& elt : __node_map)
42 for (
const auto& elt : __elt_map)
47 template <
typename GUM_SCALAR >
51 for (
const auto ci : prm.
classes()) {
55 for (
const auto node : ci->containerDag().nodes())
56 __addNode(ci, ci->get(node));
63 for (
const auto node : ii->containerDag().nodes()) {
64 __addNode(ii, ii->get(node));
69 for (
const auto cc : prm.
classes())
70 for (
const auto node : cc->containerDag().nodes())
71 __addArcs(*cc, node, *(__node_map[cc]));
75 template <
typename GUM_SCALAR >
80 switch (c.
get(node).elt_type()) {
86 __graph.addArc((*(__node_map[&(sc.
end())]))[&(
96 __graph.addArc(map[&(c.
get(node))], map[&(c.
get(chi))]);
106 template <
typename GUM_SCALAR >
113 template <
typename GUM_SCALAR >
116 __graph(source.__graph),
117 __modalitites(source.__modalitites), __elt_map(source.__elt_map) {
128 template <
typename GUM_SCALAR >
133 template <
typename GUM_SCALAR >
139 template <
typename GUM_SCALAR >
146 template <
typename GUM_SCALAR >
152 template <
typename GUM_SCALAR >
~ClassDependencyGraph()
Destructor.
DAG __graph
The graph itself.
const DAG & dag() const
Returns a constant reference over the graph of the DAG representing the ClassDependencyGraph<GUM_SCAL...
const Set< PRMClass< GUM_SCALAR > *> & classes() const
Returns the Set of all Class<GUM_SCALAR> in this PRM.
Abstract class representing an element of PRM class.
const Set< PRMInterface< GUM_SCALAR > *> & interfaces() const
Returns the Set of all Class<GUM_SCALAR> in this PRM.
const EltPair & get(NodeId id) const
Returns a constant reference over the element assiociated with the node id in the ClassDependencyGrap...
NodeMap __node_map
Map each Class to a HashTable mapping the Class's ClassElements to their assigned NodeId in __graph...
virtual PRMClassElement< GUM_SCALAR > & get(const std::string &name)=0
Getter on a member of this PRMClassElementContainer.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual NodeId addNode()
insert a new node and return its id
ClassDependencyGraph(const PRM< GUM_SCALAR > &prm)
Default constructor.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The class for generic Hash Tables.
std::pair< const PRMClassElementContainer< GUM_SCALAR > *, const PRMClassElement< GUM_SCALAR > *> EltPair
Association between a class element and it's holding class.
NodeProperty< Size > __modalitites
The modalities map for each node in the ClassDependencyGraph<GUM_SCALAR>. This is useful when using a...
void __buildGraph(const PRM< GUM_SCALAR > &prm)
Build the class dependency graph.
PRMClassElementContainer< GUM_SCALAR > & end()
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. ...
This class represent the dependencies of all classes in a PRM<GUM_SCALAR>.
virtual ClassElementType elt_type() const =0
Return the type of class element this object is.
virtual PRMType & type()=0
Return a reference over the gum::PRMType of this class element.
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum...
void __addNode(const PRMClassElementContainer< GUM_SCALAR > *c, const PRMClassElement< GUM_SCALAR > &elt)
Add nodes in __graph while updating consequently all the mappings.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
<agrum/PRM/classElementContainer.h>
void __addArcs(const PRMClassElementContainer< GUM_SCALAR > &c, NodeId node, HashTable< const PRMClassElement< GUM_SCALAR > *, NodeId > &map)
Add arcs in __graph.
const NodeProperty< Size > & modalities() const
Returns a mapping between the ClassDependencyGraph<GUM_SCALAR>'s nodes and their modalities.
PRMClassElement< GUM_SCALAR > & lastElt()
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggre...
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.
Size NodeId
Type for node ids.
NodeProperty< EltPair *> __elt_map
Mapping between the nodes in __graph with the PRMClassElement<GUM_SCALAR> in the PRM<GUM_SCALAR>.