21 #ifndef DATA_STRUCTURESMATCH_H
22 #define DATA_STRUCTURESMATCH_H
24 #include "../basic_types/globals.h"
25 #include "../basic_types/IDPartition.h"
44 typedef unordered_map<IDType,IDType>::iterator
iterator;
55 typedef unordered_map<IDType, unordered_set<IDType>>
Inversion;
80 size_t delSrc(unordered_set<IDType>
const& sources);
94 size_t delTar(unordered_set<IDType>
const& targets);
216 friend std::ostream& operator<<(std::ostream& ost,
Mapping const& map);
void clear()
Removes all pairs stores in this Mapping.
Definition: Mapping.cpp:186
IDType & operator[](IDType const &src)
Returns the ID to which the given ID is mapped.
Definition: Mapping.cpp:169
Mapping::iterator begin() noexcept
Returns an iterator to the first element of this Mapping.
Definition: Mapping.cpp:145
Mapping()
Generates a new empty Mapping object.
Definition: Mapping.cpp:29
This is the data structure representing a morphism mapping from a graph to another graph...
Definition: Mapping.h:36
bool hasSrc(IDType const &source) const
Returns whether the given ID is mapped to some ID by this Mapping.
Definition: Mapping.cpp:111
Mapping::const_iterator cend() const noexcept
Returns a const_iterator pointing beyond the last element of this Mapping.
Definition: Mapping.cpp:165
unordered_map< IDType, IDType >::const_iterator const_iterator
A const_iterator for enumerating all (IDType,IDType)-pairs stores in this Mapping.
Definition: Mapping.h:49
shared_ptr< Mapping const > Mapping_csp
Alias for a shared pointer to a constant Mapping object.
Definition: Mapping.h:243
IDType const & getTar(IDType const &source) const
Returns the ID to which the given ID is mapped.
Definition: Mapping.cpp:56
size_t delTar(IDType const &target)
Removes all mappings to the target ID.
Definition: Mapping.cpp:73
bool delSrc(IDType const &source)
Removes the mapping for the given ID, if it exists.
Definition: Mapping.cpp:60
unordered_map< IDType, IDType >::iterator iterator
An iterator for enumerating all (IDType,IDType)-pairs stores in this Mapping.
Definition: Mapping.h:44
unordered_map< IDType, unordered_set< IDType > > Inversion
Alias for an inverse Mapping, mapping IDs to collections of IDs.
Definition: Mapping.h:55
~Mapping()
Destroys this Mapping.
Definition: Mapping.cpp:31
shared_ptr< Mapping > Mapping_sp
Alias for a shared pointer to a Mapping object.
Definition: Mapping.h:238
Mapping::Inversion getInverseMatch() const
Returns an Inversion of this Mapping.
Definition: Mapping.cpp:43
Mapping::iterator end() noexcept
Returns an iterator pointing beyond the last element of this Mapping.
Definition: Mapping.cpp:157
Mapping::const_iterator cbegin() const noexcept
Returns a const_iterator to the first element of this Mapping.
Definition: Mapping.cpp:149
bool hasTar(IDType const &target) const
Returns whether some ID is mapped to the given ID by this Mapping.
Definition: Mapping.cpp:116
void concat(Mapping const &map)
Concatenates the given Mapping to the right of this Mapping, effectively changing this Mapping...
Definition: Mapping.cpp:125
unsigned int IDType
IDType is an (unsigned) integer specifically used as an Identifier of graphs, elements of graphs or a...
Definition: globals.h:53
bool isInjective() const
Returns whether this Mapping is injective on all IDs on which it is defined.
Definition: Mapping.cpp:173
unordered_map< IDType, IDType > match
Stores the data of this Mapping.
Definition: Mapping.h:231