Commit db35ec49 authored by Vincent Delecroix's avatar Vincent Delecroix

more methods for the core automaton

- num_triangulations (and alias num_states)
- num_transitions
- num_geometric_triangulations
- num_cylindrical_triangulations
parent 3d026dad
...@@ -285,6 +285,36 @@ class Automaton(object): ...@@ -285,6 +285,36 @@ class Automaton(object):
""" """
return iter(self) 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): def geometric_triangulations(self, method=None):
r""" r"""
Return an iterator over the pairs (veering triangulation, Return an iterator over the pairs (veering triangulation,
...@@ -311,6 +341,20 @@ class Automaton(object): ...@@ -311,6 +341,20 @@ class Automaton(object):
if p.affine_dimension() == 2*dim: if p.affine_dimension() == 2*dim:
yield vt, p 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): def cylindrical_triangulations(self):
r""" r"""
Return an iterator over cylindrical configurations. Return an iterator over cylindrical configurations.
...@@ -335,6 +379,20 @@ class Automaton(object): ...@@ -335,6 +379,20 @@ class Automaton(object):
if vt.is_cylindrical(): if vt.is_cylindrical():
yield vt 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 @classmethod
def from_triangulation(self, T, verbose=0, mode='core', **kwargs): def from_triangulation(self, T, verbose=0, mode='core', **kwargs):
assert T.is_core() assert T.is_core()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment