Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Automaton.run #42

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions veerer/automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,40 @@ def run(self, max_size=None):
sage: C.run()
sage: C
Reduced core veering automaton with 356 vertices

TESTS::

sage: from veerer import VeeringTriangulation, CoreAutomaton
sage: T = VeeringTriangulation("(0,2,~1)(1,~0,~2)", "RBB")
sage: A = CoreAutomaton()
sage: A
Uninitialized core veering automaton with 0 vertex
sage: A.set_seed(T)
sage: A
Partial core veering automaton with 1 vertex
sage: A.run(1)
sage: A
Partial core veering automaton with 2 vertices
sage: A.run(1)
sage: A
Core veering automaton with 2 vertices

sage: A0 = CoreAutomaton()
sage: A0.set_seed(T)
sage: A0.run()
sage: A0._flip_branch
[[]]
sage: A1 = CoreAutomaton()
sage: A1.set_seed(T)
sage: A1.run(1)
sage: A1.run(1)
sage: A1._flip_branch
[[]]
"""
if not self._flip_branch:
raise ValueError('uninitialized automaton; call set_seed() first')

if len(self._flip_branch) == 1 and not self._flip_branch[0]:
return

T = self._state
Expand Down Expand Up @@ -683,6 +715,8 @@ def run(self, max_size=None):
flip_branch.pop()
assert T == state_branch[-1]
if not flip_branch[-1]:
# done
assert len(flip_branch) == 1
break

if self._verbosity == 1:
Expand Down
Loading