|
| | TypeTrie ()=default |
| | Creates an empty trie.
|
| | TypeTrie (const TypeTrie &src) |
| | Creates a new copy of the given trie.
|
| | TypeTrie (TypeTrie &&src) noexcept |
| | Moves the contents of the given trie into this new trie.
|
| TypeTrie & | operator= (const TypeTrie &src) |
| | Sets this to be a copy of the given trie.
|
| TypeTrie & | operator= (TypeTrie &&src) noexcept |
| | Moves the contents of the given trie into this trie.
|
| void | swap (TypeTrie &other) noexcept |
| | Swaps the contents of this and the given trie.
|
| bool | operator== (const TypeTrie &other) const |
| | Determines whether this and the given trie store exactly the same type vectors.
|
| void | clear () |
| | Resets this to the empty trie.
|
| void | insert (const char *entry, size_t len) |
| | Inserts the given type vector into this trie.
|
| bool | dominates (const char *vec, size_t len) const |
| | Determines whether the given type vector dominates any vector in this trie.
|
| void | writeTextShort (std::ostream &out) const |
| | Writes a short text representation of this object to the given output stream.
|
| void | writeTextLong (std::ostream &out) const |
| | Writes a detailed text representation of this object to the given output stream.
|
| std::string | str () const |
| | Returns a short text representation of this object.
|
| std::string | utf8 () const |
| | Returns a short text representation of this object using unicode characters.
|
| std::string | detail () const |
| | Returns a detailed text representation of this object.
|
template<int nTypes>
class regina::TypeTrie< nTypes >
A trie that stores a set of type vectors of a fixed length.
This class forms part of the tree traversal algorithm for enumerating vertex normal surfaces, as described in "A tree traversal algorithm
for decision problems in knot theory and 3-manifold topology", Burton and Ozlen, Algorithmica 65:4 (2013), pp. 772-801.
A type vector is a sequence of digits, each between 0 and nTypes-1 inclusive. Type vectors are represented as arrays of characters: these are not strings, but simply sequences of one-byte integers. In particular, you cannot print them (since they use raw integer values, not ASCII digits). The length of a type vector must be passed alongside it (i.e., there is no special terminating character).
A type vector v is said to dominate u if, for each position i, either v[i] == u[i] or else u[i] == 0. So, for instance, (1,0,2,3) dominates (1,0,2,0), which in turn dominates (1,0,0,0). Domination is a partial order, not a total order: for instance, neither of (1,0,2,0) or (1,0,3,0) dominates the other.
We assume that all type vectors used in this trie have the same length. This is important, since we optimise the implementation by ignoring trailing zeroes, which means that this trie cannot distinguish between a vector v and the same vector with additional zeroes appended to its end.
This class implements C++ move semantics and adheres to the C++ Swappable requirement. It is designed to avoid deep copies wherever possible, even when passing or returning objects by value. However, be aware that the cost of moving is linear in the template parameter nTypes (which, as noted below, is usually very small).
- Precondition
- nTypes is between 1 and 256 inclusive. The typical value for nTypes for normal surface enumeration is either 4 or 7 (depending upon whether we are supporting almost normal surfaces).
- Python
- This is available only for the template parameters nTypes = 4 and 7, under the names TypeTrie4 and TypeTrie7 respectively.