flipper.kernel.triangulation.Triangulation

class flipper.kernel.triangulation.Triangulation(triangles)[source]

Bases: object

This represents a triangulation of a punctured surface.

It is specified by a list of Triangles. Its edges must be numbered 0, 1, … and its vertices must be numbered 0, 1, …

all_encodings(depth, prefix=None)[source]

Return all encodings that can be defined by at most the given number of flips.

all_flips(depth, prefix=None)[source]

Return all flip sequences of at most the given number of flips.

all_mapping_classes(depth, prefix=None)[source]

Return all mapping classes that can be defined by at most the given number of flips followed by one isometry.

components()[source]

Return a list of pairs (connected component of self, embedding).

corner_class_of_vertex(vertex)[source]

Return the corner class containing the given vertex.

corner_of_edge(edge_label)[source]

Return the corner opposite the given edge.

empty_lamination()[source]

Return an empty lamination on this surface.

encode(sequence, _cache=None)[source]

Return the encoding given by sequence.

This consists of EdgeFlips, Isometries and LinearTransformations. Furthermore there are several conventions that allow these to be specified by a smaller amount of information.

  • An integer x represents EdgeFlip(…, edge_label=x)
  • A dictionary which has i or ~i as a key (for every i) represents a relabelling.
  • A dictionary which is missing i and ~i (for some i) represents an isometry back to this triangulation.
  • None represents the identity isometry.

This sequence is read in reverse in order respect composition. For example self.encode([1, {1: ~2}, 2, 3, ~4]) is the mapping class which: flips edge ~4, then 3, then 2, then relabels back to the starting triangulation via the isometry which takes 1 to ~2 and then finally flips edge 1.

encode_flip(edge_label)[source]

Return an encoding of the effect of flipping the given edge.

The given edge must be flippable.

encode_flips_and_close(edge_labels, edge_from_label, edge_to_label)[source]

DEPRECIATED: Return an encoding of the effect of flipping the given sequences of edges followed by an isometry.

The isometry used is the one taking edge_from_label to edge_to_label.

This function has been depreciated in favour of self.encode(). It is equivalent to self.encode([{edge_from_label: edge_to_label}] + list(reversed(edge_labels))). Note that edge_labels needs to be reversed in order to match the order of composition used in self.encode().

encode_relabel_edges(label_map)[source]

Return an encoding of the effect of flipping the given edge.

find_isometry(other, label_map, respect_fillings=True)[source]

Return the isometry from this triangulation to other defined by label_map.

label_map must be a dictionary mapping self.labels to other.labels. Labels may be omitted if they are determined by other given ones and these will be found automatically.

Assumes (and checks) that such an isometry exists and is unique.

flip_edge(edge_label)[source]

Return a new triangulation obtained by flipping the given edge.

The chosen edge must be flippable.

flippable_edges()[source]

Return this list of flippable edges of this triangulation.

classmethod from_string(signature)[source]

Return the triangulation described by the given isomorphism signature.

See the appendix of:

  • Simplification paths in the Pachner graphs of closed orientable, and
  • 3-manifold triangulations

for a more detailed description of this construction.

classmethod from_tuple(edge_labels, vertex_labels=None, vertex_states=None)[source]

Return an Triangulation from a list of triples of edge labels.

Let T be an ideal triangulaton of the punctured (oriented) surface S. Orient and edge e of T and assign an index i(e) in 0, …, zeta-1. Now to each triangle t of T associate the triple j)t) := (j(e_1), j(e_2), j(e_3)) where:

  • e_1, e_2, e_3 are the edges of t, ordered acording to the orientation of t, and
  • j(e) = i(e) if the orientation of e agrees with that of t else ~i(e)

Here ~x := -1 - x, the two’s complement of x.

We may describe T by the list [j(t) for t in T]. This function reconstructs T from such a list.

edge_labels must be a list of triples of integers and each of 0, …, zeta-1, ~0, …, ~(zeta-1) must occur exactly once.

Two optional arguments allow the states of vertices to be specified. These are intended to only really be used by pickling methods.

Firstly, if given, vertex_labels is a dictionary taking x to the label of the vertex opposite edge x. Vertices can be labelled by anything but using something like 0, …, num_vertices-1 is sensible.

Secondly, if given, vertex_states is a dict, list or tuple of Boolean flags such that the vertex labelled i is filled iff vertex_states[i] == True.

homology_basis()[source]

Return a basis for H_1 of the underlying punctured surface.

Each element is given as a path in the dual 1–skeleton and corrsponds to a good curve. Each path will meet each edge at most once.

Each pair of paths is guaranteed to meet at most once.

id_encoding()[source]

Return an encoding of the identity map on this triangulation.

id_isometry()[source]

Return the isometry representing the identity map.

is_flippable(edge_label)[source]

Return if the given edge is flippable.

An edge is flippable if and only if it lies in two distinct triangles.

is_isometric_to(other)[source]

Return if there are any orientation preserving isometries from this triangulation to other.

iso_sig(preserve_orientation=False, skip=None, start_points=None)[source]

Return the isomorphism signature of this triangulation as described by Ben Burton.

This is a string such that two triangulations have the same signature if and only if there is a homeomorphism taking one to the other.

If skip is not None then it must be an iterable containing the labels of edges to treat as boundary. If preserve_orientation is True then this identifying homeomorphism must be orientation preserving.

If start_points is not None then it must be an iterable containing pairs: (edge_lable, oriented) which specifies a corner to start with and whether to orient this corner to match the orientation of the triangle. This can be used to generate signatures relative to a fixed boundary by specify an edge on that boundary (and True) as the only starting point.

isometries_to(other, respect_fillings=True)[source]

Return a list of all isometries from this triangulation to other.

key_curves()[source]

Return a list of curves which fill the underlying surface and include a basis for H_1(S).

As these fill, by Alexander’s trick a mapping class is the identity if and only if it fixes all of them, including orientation.

lamination(geometric, algebraic=None, remove_peripheral=True)[source]

Return a new lamination on this surface assigning the specified weight to each edge.

nonflippable_boundary(edge_label)[source]

Return the label of the edge bounding the once-punctured monogon containing edge_label.

The given edge must not be flippable.

opposite_corner(corner)[source]

Return the corner opposite the given corner.

package()[source]

Return a small amount of info that create_triagulation can use to reconstruct this triangulation.

random_curve(num_flips)[source]

Return a random curve on this surface.

relabel_edges(label_map)[source]

Return a new triangulation obtained by relabelling the edges according to label_map.

rotate_corner(corner)[source]

Return the corner obtained by rotating the given corner one click anti-clockwise.

self_isometries()[source]

Returns a list of isometries taking this triangulation to itself.

square_about_edge(edge_label)[source]

Return the four edges around the given edge.

The chosen edge must be flippable.

tree_and_dual_tree(respect_fillings=False)[source]

Return a maximal tree in the 1–skeleton of this triangulation and a maximal tree in 1–skeleton of the dual of this triangulation.

These are given as lists of Booleans signaling if each edge is in the tree. No edge is used in both the tree and the dual tree. Note that when this surface is disconnected this tree is actually a forest.

triangles_of_edge(edge_label)[source]

Return the two triangles containing the given edge.

vertices_of_edge(edge_label)[source]

Return the two vertices at the ends of the given edge.