44 double similarityThreshold) :
45 __leavesCpt(idSource),
46 __similarityThreshold(similarityThreshold) {
65 pairIter != leafIter.val()->endSafe();
69 leafIter.val()->erase(curPair);
72 delete leafIter.val();
101 (leafIter.val())->insert(p);
125 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())) {
130 if ((*fusIter)->addPair(*pairIter))
__removeContext(fusIter.pos() + 1);
135 bag << (*fusIter)->leafAssociatedPair(l);
152 (*pairIter)->updateLikelyhood();
163 if ((*fusIter)->leaf()->contains(curLeaf->
id())) {
165 if ((*fusIter)->updateAllAssociatedLeaves())
167 bag = (*fusIter)->associatedPairs();
168 curLeaf = (*fusIter)->leaf();
175 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())
176 || (*fusIter)->leaf()->contains((*pairIter)->firstLeaf()->id())) {
181 if ((*fusIter)->updatePair(*pairIter))
__removeContext(fusIter.pos() + 1);
183 if ((*fusIter)->updateAssociatedLeaf(curLeaf))
185 bag << (*fusIter)->leafAssociatedPair(curLeaf);
203 (*
__leaf2Pair[(*pairIter)->otherLeaf(l)]) >> *pairIter;
216 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())
217 || (*fusIter)->leaf()->contains((*pairIter)->firstLeaf()->id())) {
222 if ((*fusIter)->removePair(*pairIter)) {
227 bag << (*fusIter)->leafAssociatedPair(l);
228 toBeDeleted << (*fusIter)->leafAssociatedPair(l);
230 if ((*fusIter)->deassociateLeaf(l)) {
__removeContext(fusIter.pos() + 1); }
234 pairIter != toBeDeleted.
endSafe();
267 for (
pair_iterator pairIter = pb; pairIter != pe; ++pairIter) {
268 if (!newLeaf->
contains(pairIter.key()->firstLeaf()->id())
269 && !newLeaf->
contains(pairIter.key()->secondLeaf()->id()))
270 newContext->
addPair(pairIter.key());
271 if (!newLeaf->
contains(pairIter.key()->firstLeaf()->id())
274 if (!newLeaf->
contains(pairIter.key()->secondLeaf()->id())
294 bool alreadyIn =
false;
299 if (mapIter.val()->contains((*fusIter)->leaf()->id())) {
303 if (!alreadyIn) retMap.
insert((*fusIter)->leaf()->id(), (*fusIter)->leaf());
314 if (mapIter.val()->contains(leafIter.key()->id())) {
315 retMap.
insert(leafIter.key()->id(), mapIter.val());
318 if (!retMap.
exists(leafIter.key()->id()))
319 retMap.
insert(leafIter.key()->id(), leafIter.key());
327 std::stringstream ss;
328 ss <<
"################\nTas Initial : " << std::endl
333 ss <<
"################\nTas " << fusIter.pos() <<
" : " << std::endl
334 << (*fusIter)->toString();
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
Safe iterators for Sequence.
void __removeInitialPair(LeafPair *)
AbstractLeaf * convert2Leaf(NodeId leafId) const
Returns a leaf matching data and having given id as id.
const iterator_safe & endSafe() noexcept
Returns the safe iterator pointing to the end of the hashtable.
Safe iterators for the Set classDevelopers may consider using Set<x>::iterator_safe instead of SetIte...
<agrum/FMDP/learning/FunctionGraph/leafAggregator.h>
bool removePair(LeafPair *p)
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
Safe Const Iterators for hashtables.
<agrum/FMDP/learning/datastructure/leaves/leafPair.h>
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
NodeGraphPart * __leavesCpt
void __addInitialPair(LeafPair *)
Safe Iterators for hashtables.
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
The class for generic Hash Tables.
Representation of a setA Set is a structure that contains arbitrary elements.
const iterator_safe & endSafe() const noexcept
The usual safe end iterator to parse the set.
~LeafAggregator()
Default destructor.
Sequence< FusionContext< false > *> __fusionSeq
AbstractLeaf * otherLeaf(AbstractLeaf *l) const
LeafAggregator(NodeGraphPart *idSource, double similarityThreshold)
Default constructor.
Class for node sets in graph.
bool addPair(LeafPair *p)
HashTable< NodeId, AbstractLeaf *> leavesMap()
FusionContext< true > * __initialContext
HashTable< AbstractLeaf *, Set< LeafPair *> *> __leaf2Pair
iterator_safe beginSafe()
Returns the safe iterator pointing to the beginning of the hashtable.
iterator_safe beginSafe() const
The usual safe begin iterator to parse the set.
bool containsAssociatedLeaf(AbstractLeaf *l)
Size Idx
Type for indexes.
void removeLeaf(AbstractLeaf *)
void clear()
Removes all the elements, if any, from the set.
bool associateLeaf(AbstractLeaf *l)
double __similarityThreshold
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
bool updateLeaf(AbstractLeaf *)
void __removeContext(Idx)
double likelyhood()
Updates GStatistic.
void addLeaf(AbstractLeaf *)
void insert(const Key &k)
Inserts a new element into the set.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool updatePair(LeafPair *p)
void updateLikelyhood()
Updates GStatistic.
pair_iterator beginPairs()
virtual void eraseNode(const NodeId id)
erase the node with the given id
void __updateInitialPair(LeafPair *)