Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
InducedEquivalence.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include <alib/set>
27#include <alib/map>
28
29namespace relation {
30
35public:
44 template < class T >
46};
47
48template < class T >
51
52 for ( const ext::pair < T, T > & item : relation ) {
53 transform [ item.first ].insert ( item.second );
54 }
55
57
58 for ( const std::pair < const T, ext::set < T > > & item : transform ) {
59 res.insert ( item.second );
60 }
61
62 return res;
63}
64
65} /* namespace relation */
66
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Definition: set.hpp:44
Definition: InducedEquivalence.h:34
static ext::set< ext::set< T > > inducedEquivalence(const ext::set< ext::pair< T, T > > &relation)
Definition: InducedEquivalence.h:49
return res
Definition: MinimizeByPartitioning.h:145
ContainerType< ResType > transform(const ContainerType< InType, Ts ... > &in, Callback transform)
In container tranformation of all elements according to the tranform.
Definition: algorithm.hpp:150
Definition: InducedEquivalence.h:29