Polymake Template Library (PTL)
4.2
|
An equivalence relation on the integers 0,..,n-1
for a given size n
.
More...
Public Member Functions | |
EquivalenceRelation () | |
Creates the trivial equivalence relation on the empty set. | |
EquivalenceRelation (Int size) | |
template<typename Container > | |
EquivalenceRelation (Int size, const Container &represent) | |
Int | representative (Int e) const |
Return the representative of the equivalence class containing e. | |
const Array< Int > & | representatives () const |
Return the representatives of the equivalence classes of all elements. | |
void | merge_classes (const Int c1, const Int c2) |
Merges two equivalence classes each represented by one (arbitrary) of its elements. | |
template<typename Container > | |
void | merge_classes (const Container &classes) |
Merges the classes of all the elements contained in classes. | |
const Set< Int > & | set_of_rep () const |
Return the set of all representatives. | |
Set< Int > | equivalence_class (const Int e) const |
Return the equivalence class of the element e. | |
PowerSet< Int > | equivalence_classes () const |
Return all equivalence classes. | |
bool | related (const Int e1, const Int e2) const |
Return true iff e1 and e2 are in the same equivalence class. | |
void | set_representative (const Int e) |
The element e will be used as user defined representative of it's equivalence class. | |
An equivalence relation on the integers 0,..,n-1
for a given size n
.
Initially, each element is contained in an equivalence class by itself. Two equivalence classes can be merged by specifying one (arbitrary) representative of each class. Alternatively, a set of representatives may be specified and the corresponding equivalence classes will be merged.
Each equivalence class is represented by its smallest element (default) or alternatively by a user defined element. If classes with user defined representatives are merged, the smallest of the user defined representatives is chosen to represent the new equivalence class.
|
inlineexplicit |
Creates the equivalence relation on the integers 0,..,size-1 where each element is contained in an equivalence class by itself.
|
inline |
Creates the equivalence relation on the integers 0,..,size-1 where each element is contained in an equivalence class by itself. The representatives will be used as user defined representatives.