| |
- builtins.object
-
- EquivalenceClass
class EquivalenceClass(builtins.object) |
|
Implements an Equivalnce class data type: values are added as
singletons, equivalance classes are merged, we can ask
whether two values are in the same equivalance class, and
we can get a set of equivalence classes (each a set). |
|
Methods defined here:
- __add__(self, x)
- Overload syntax: e = e + x is the same as e.add_singleton(x)
- __bool__(self)
- Determine the truth of an equivalence class: non-unitary equivalence classes are True
- __init__(self, inital_contents)
- Equivalence class is constructed to store initial_contents
(it can be any iterable), each a a singleton
- __iter__(self)
- Implement the constructor for the iterator protocol
- __str__(self)
- add_singleton(self, v)
- Add value v as its own singleton
- all_classes(self)
- clear(self)
- Clear the equivalence class
- in_same_class(self, a, b)
- return whether a and b are in the same equivalence class, possibly
shortening some paths to the root
- is_singleton(self)
- Return whether there is just one class in the equivalence class
- merge_classes_containing(self, a, b)
- Merge the equivalence classes storing a and b, , possibly
shortening some paths to the root
- size(self)
- Return the number of different (unequivalent) classes
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |