flipper.kernel.equippedtriangulation.EquippedTriangulation

class flipper.kernel.equippedtriangulation.EquippedTriangulation(triangulation, laminations, mapping_classes)[source]

Bases: object

This represents a triangulation along with a collection of named laminations and mapping classes on it.

Most importantly this object can construct a mapping class from a string descriptor. See self.mapping_class for additional information.

all_mapping_classes(length, prefix=None, **options)[source]

Yield all mapping classes of at most the specified length.

There are several equivalence relations defined on these mapping classes. We may try to only one of each:

  • mapping class group element (==),
  • conjugacy class (~~), or
  • fibre class (~?).

Valid options and their defaults:

  • equivalence=’bundle’ – equivalence relation to use. ‘bundle’, ‘conjugacy’, ‘group’, ‘none’
  • exact=False – skip words that do not have exactly the required length.
  • letters=self.mapping_classes - a list of available letters to use, in alphabetical order.
  • skip=None – an iterable containing substrings that cannot appear.
  • relator_len=2 – if skip is not given then search words of length at most this much looking for relations.
  • prefilter=None – filter the prefixes of words by this function.
  • filter=None – filter the words by this function.
  • apply=None – apply the given function to the words.
  • cores=None – how many cores to use.
  • prefix_depth=3 – depth to search for prefixes for other cores.

Notes

  • By default letters are sorted by (length, lower case, swapcase).
  • For the equivalence used bundle ==> conjugacy ==> group.
  • The function given toapply must be a pickleable if using multiple cores.
all_words(length, prefix=None, **options)[source]

Yield all words of at most the specified length.

There are several equivalence relations defined on these words. Words may represent the same:

  • mapping class group element (==),
  • conjugacy class (~~), or
  • fibre class (~?).

Valid options and their defaults:

  • equivalence=’bundle’ – equivalence relation to use. ‘bundle’, ‘conjugacy’, ‘group’, ‘none’
  • exact=False – skip words that do not have exactly the required length.
  • letters=self.mapping_classes - a list of available letters to use, in alphabetical order.
  • skip=None – an iterable containing substrings that cannot appear.
  • relator_len=2 – if skip is not given then search words of length at most this much looking for relations.
  • prefilter=None – filter the prefixes of words by this function.
  • filter=None – filter the words by this function.
  • apply=None – apply the given function to the words.
  • cores=None – how many cores to use.
  • prefix_depth=4 – depth to search for prefixes for other cores.

Notes

  • By default letters are sorted by (length, lower case, swapcase).
  • For the equivalence used bundle ==> conjugacy ==> group.
  • The function given toapply must be a pickleable if using multiple cores.
decompose_word(word)[source]

Return a list of mapping_classes keys whose concatenation is word and the keys are chosen greedly.

Raises a KeyError if the greedy decomposition fails.

classmethod from_tuple(objects)[source]

Create an EquippedTriangulation from a list of triangulations, laminations and mapping classes.

Objects must be a non-empty list where each item is:

  1. an triangulation (at most one may be given),
  2. a Lamination,
  3. an Encoding,
  4. a pair (String, Lamination),
  5. a pair (String, Encoding).

All laminations / mapping classes must be defined on the same triangulation We will automatically name items of type 2) and 3) sequentially a, b, …, z, aa, ab, … .

generate_skip(length, letters=None)[source]

Return a dictionary whose keys are substrings that cannot appear in reduced words.

lamination(name)[source]

Return the lamination given by name.

mapping_class(word)[source]

Return the mapping class corresponding to the given word or a random one of given length if given an integer.

The given word is decomposed using self.decompose_word and the composition of the mapping classes involved is returned.

Raises a TypeError if the word does not correspond to a mapping class.

random_word(length, positive=True, negative=True, letters=None)[source]

Return a random word of the required length.

The letters to choose from can be specified or, alternatively, the set of positive, negative or all (default) mapping classes can be used by using the flags postive and negative.