UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
Mapping Class Reference

This is the data structure representing a morphism mapping from a graph to another graph. More...

#include <Mapping.h>

Collaboration diagram for Mapping:
Collaboration graph
[legend]

Public Types

typedef unordered_map< IDType,
IDType >::iterator 
iterator
 An iterator for enumerating all (IDType,IDType)-pairs stores in this Mapping.
 
typedef unordered_map< IDType,
IDType >::const_iterator 
const_iterator
 A const_iterator for enumerating all (IDType,IDType)-pairs stores in this Mapping.
 
typedef unordered_map< IDType,
unordered_set< IDType > > 
Inversion
 Alias for an inverse Mapping, mapping IDs to collections of IDs. More...
 

Public Member Functions

 Mapping ()
 Generates a new empty Mapping object.
 
 ~Mapping ()
 Destroys this Mapping.
 
bool delSrc (IDType const &source)
 Removes the mapping for the given ID, if it exists. More...
 
size_t delSrc (unordered_set< IDType > const &sources)
 Removes all mappings of the given IDs. More...
 
size_t delTar (IDType const &target)
 Removes all mappings to the target ID. More...
 
size_t delTar (unordered_set< IDType > const &targets)
 Removes all mappings to one of the target IDs. More...
 
bool hasSrc (IDType const &source) const
 Returns whether the given ID is mapped to some ID by this Mapping. More...
 
bool hasTar (IDType const &target) const
 Returns whether some ID is mapped to the given ID by this Mapping. More...
 
IDType const & getTar (IDType const &source) const
 Returns the ID to which the given ID is mapped. More...
 
void concat (Mapping const &map)
 Concatenates the given Mapping to the right of this Mapping, effectively changing this Mapping. More...
 
IDTypeoperator[] (IDType const &src)
 Returns the ID to which the given ID is mapped. More...
 
unordered_set< IDTypegetInverseMatch (IDType const &tar) const
 Returns the set of all IDs which are mapped to the given ID. More...
 
Mapping::Inversion getInverseMatch () const
 Returns an Inversion of this Mapping. More...
 
void getInverseMatch (Mapping::Inversion &invmatch) const
 Clears the given Inversion and stores the Inversion of this Mapping in the given one. More...
 
bool isInjective () const
 Returns whether this Mapping is injective on all IDs on which it is defined. More...
 
Mapping::iterator begin () noexcept
 Returns an iterator to the first element of this Mapping. More...
 
Mapping::const_iterator begin () const noexcept
 Returns a const_iterator to the first element of this Mapping. More...
 
Mapping::const_iterator cbegin () const noexcept
 Returns a const_iterator to the first element of this Mapping. More...
 
Mapping::iterator end () noexcept
 Returns an iterator pointing beyond the last element of this Mapping. More...
 
Mapping::const_iterator end () const noexcept
 Returns a const_iterator pointing beyond the last element of this Mapping. More...
 
Mapping::const_iterator cend () const noexcept
 Returns a const_iterator pointing beyond the last element of this Mapping. More...
 
void clear ()
 Removes all pairs stores in this Mapping.
 

Private Attributes

unordered_map< IDType, IDTypematch
 Stores the data of this Mapping.
 

Friends

std::ostream & operator<< (std::ostream &ost, Mapping const &map)
 Streams a string representation of the given Mapping to the given string. More...
 
bool operator== (const Mapping &m1, const Mapping &m2)
 Returns true, if and only if the given Mappings are equal (i.e. More...
 

Detailed Description

This is the data structure representing a morphism mapping from a graph to another graph.

The morphism property is not (automatically) ensured by this class! It just stores the mapping and provides manipulation methods.

Author
Jan Stückrath

Member Typedef Documentation

typedef unordered_map<IDType, unordered_set<IDType> > Inversion

Alias for an inverse Mapping, mapping IDs to collections of IDs.

This type is essentially an mapping with reversed direction, but without the function support of the Mapping class.

Member Function Documentation

Mapping::iterator begin ( )
noexcept

Returns an iterator to the first element of this Mapping.

Note that there is not guaranteed order on the pairs of this Mapping!

Returns
an iterator to the first element of this Mapping
Mapping::const_iterator begin ( ) const
noexcept

Returns a const_iterator to the first element of this Mapping.

Note that there is not guaranteed order on the pairs of this Mapping!

Returns
a const_iterator to the first element of this Mapping
Mapping::const_iterator cbegin ( ) const
noexcept

Returns a const_iterator to the first element of this Mapping.

Note that there is not guaranteed order on the pairs of this Mapping!

Returns
a const_iterator to the first element of this Mapping
Mapping::const_iterator cend ( ) const
noexcept

Returns a const_iterator pointing beyond the last element of this Mapping.

Note that there is not guaranteed order on the pairs of this Mapping!

Returns
a const_iterator pointing beyond the last element of this Mapping
void concat ( Mapping const &  map)

Concatenates the given Mapping to the right of this Mapping, effectively changing this Mapping.

The new Mapping contains a pair (x,y) if and only if x was mapped to some z by the old Mapping and z was mapped to y by the given Mapping.

Parameters
mapthe Mapping which will be concatenated to this Mapping
bool delSrc ( IDType const &  source)

Removes the mapping for the given ID, if it exists.

Parameters
sourcethe ID of which to mapping should be deleted
Returns
true, iff there was a mapping deleted (false if the given ID had no mapping)
size_t delSrc ( unordered_set< IDType > const &  sources)

Removes all mappings of the given IDs.

IDs without mappings are ignored and the number of deleted mappings is returned.

Parameters
sourcesthe set of IDs of which to mappings should be deleted
Returns
the number of mappings deleted (i.e. the number of given ID which had a mapping)
size_t delTar ( IDType const &  target)

Removes all mappings to the target ID.

The number of removed mappings is returned.

Parameters
targetall mappings to this ID will be deleted
Returns
the number of mappings deleted
size_t delTar ( unordered_set< IDType > const &  targets)

Removes all mappings to one of the target IDs.

The number of removed mappings is returned.

Parameters
targetsall mappings to one of this IDs will be deleted
Returns
the number of mappings deleted
Mapping::iterator end ( )
noexcept

Returns an iterator pointing beyond the last element of this Mapping.

Note that there is not guaranteed order on the pairs of this Mapping!

Returns
an iterator pointing beyond the last element of this Mapping
Mapping::const_iterator end ( ) const
noexcept

Returns a const_iterator pointing beyond the last element of this Mapping.

Note that there is not guaranteed order on the pairs of this Mapping!

Returns
a const_iterator pointing beyond the last element of this Mapping
unordered_set< IDType > getInverseMatch ( IDType const &  tar) const

Returns the set of all IDs which are mapped to the given ID.

Parameters
tarthe target ID to which mappings should be found
Returns
the set of all IDs mapped to the given ID
Mapping::Inversion getInverseMatch ( ) const

Returns an Inversion of this Mapping.

The Inversion maps all target IDs of this Mapping to the set of all source IDs which are mapped to each target ID. An ID which has no ID mapped to it, has no mapping in the Inversion (obviously).

Returns
the Inversion of this Mapping
void getInverseMatch ( Mapping::Inversion invmatch) const

Clears the given Inversion and stores the Inversion of this Mapping in the given one.

The Inversion maps all target IDs of this Mapping to the set of all source IDs which are mapped to each target ID. An ID which has no ID mapped to it, has no mapping in the Inversion (obviously).

Parameters
invmatchthe Inversion which will be set to the Inversion of this Mapping
IDType const & getTar ( IDType const &  source) const

Returns the ID to which the given ID is mapped.

Parameters
sourcethe ID which should be mapped
Returns
the ID to which the given ID is mapped
bool hasSrc ( IDType const &  source) const

Returns whether the given ID is mapped to some ID by this Mapping.

Parameters
sourcethe ID which should be checked
Returns
true, iff the given ID is mapped by this Mapping
bool hasTar ( IDType const &  target) const

Returns whether some ID is mapped to the given ID by this Mapping.

Parameters
targetthe ID to be checked
Returns
true, iff there is an ID which is mapped to the given ID
bool isInjective ( ) const

Returns whether this Mapping is injective on all IDs on which it is defined.

Returns
true, iff the Mapping is injective
IDType & operator[] ( IDType const &  src)

Returns the ID to which the given ID is mapped.

If the given ID is not mapped, a new mapping from the given ID to the ID 0 is added and 0 is returned. This operator can also be used to set mappings of this Mapping.

Parameters
srcthe ID of which its image will be returned
Returns
a reference to the ID to which the given ID is mapped; 0 if the given ID had no mapping

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ost,
Mapping const &  map 
)
friend

Streams a string representation of the given Mapping to the given string.

Parameters
ostthe stream to which it will be streamed
mapthe Mapping which will be streamed
Returns
a reference to the given stream object
bool operator== ( const Mapping m1,
const Mapping m2 
)
friend

Returns true, if and only if the given Mappings are equal (i.e.

contain the same mappings).

Parameters
m1the first Mapping
m2the second Mapping
Returns
true, iff the given Mappings are equal

The documentation for this class was generated from the following files: