From db35ec49d277115e7bb0eaa3c15788917afcd8d8 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Tue, 25 Sep 2018 11:53:52 +0200 Subject: [PATCH] more methods for the core automaton - num_triangulations (and alias num_states) - num_transitions - num_geometric_triangulations - num_cylindrical_triangulations --- veerer/automaton.py | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/veerer/automaton.py b/veerer/automaton.py index d2f8d9e..8495b2b 100644 --- a/veerer/automaton.py +++ b/veerer/automaton.py @@ -285,6 +285,36 @@ class Automaton(object): """ return iter(self) + def num_triangulations(self): + r""" + Return the number of triangulations (= states of the automaton). + + EXAMPLES:: + + sage: from veerer import * + sage: from surface_dynamics import * + sage: A = Automaton.from_stratum(AbelianStratum(2)) + sage: A.num_triangulations() + 86 + """ + return len(self._graph) + + num_states = num_triangulations + + def num_transitions(self): + r""" + Return the number of transitions of this automaton. + + EXAMPLES:: + + sage: from veerer import * + sage: from surface_dynamics import * + sage: A = Automaton.from_stratum(AbelianStratum(2)) + sage: A.num_transitions() + 300 + """ + return sum(len(flips) for flips in self._graph.values()) + def geometric_triangulations(self, method=None): r""" Return an iterator over the pairs (veering triangulation, @@ -311,6 +341,20 @@ class Automaton(object): if p.affine_dimension() == 2*dim: yield vt, p + def num_geometric_triangulations(self): + r""" + Return the number of geometric triangulations (among the states). + + EXAMPLES:: + + sage: from veerer import * + sage: from surface_dynamics import * + sage: A = Automaton.from_stratum(AbelianStratum(2)) + sage: A.num_geometric_triangulations() + 54 + """ + return sum(vt.is_geometric() for vt in self) + def cylindrical_triangulations(self): r""" Return an iterator over cylindrical configurations. @@ -335,6 +379,20 @@ class Automaton(object): if vt.is_cylindrical(): yield vt + def num_cylindrical_triangulations(self): + r""" + Return the number of cylindrical triangulations (among the states). + + EXAMPLES:: + + sage: from veerer import * + sage: from surface_dynamics import * + sage: A = Automaton.from_stratum(AbelianStratum(2)) + sage: A.num_cylindrical_triangulations() + 24 + """ + return sum(vt.is_cylindrical() for vt in self) + @classmethod def from_triangulation(self, T, verbose=0, mode='core', **kwargs): assert T.is_core() -- 2.22.2