automaton.is_cycle_ambiguous

Whether the automaton is cycle ambiguous, i.e., there exist a state $s$ and a label $x$ such that there is more than one cycle in $s$ labeled with $x$.

Preconditions:

  • the labelset is free.

Examples

In [1]:
import vcsn
In [2]:
%%automaton -s a
context = "lal_char, b"
$ -> 0
0 -> $
0 -> 1 a
0 -> 2 a
1 -> 0 b
2 -> 0 b
%3 I0 0 0 I0->0 F0 0->F0 1 1 0->1 a 2 2 0->2 a 1->0 b 2->0 b

At state $0$, the automaton has two cycles "ab" so it is cycle ambiguous.

In [3]:
a.is_cycle_ambiguous()
Out[3]:
True
In [4]:
%%automaton -s a
context = "lal_char, b"
$ -> 0
0 -> $
0 -> 1 a
0 -> 2 a
1 -> 0 b
2 -> 0 c
%3 I0 0 0 I0->0 F0 0->F0 1 1 0->1 a 2 2 0->2 a 1->0 b 2->0 c

At state $0$, the automaton has two cycles with different label "ab", "ac" so it is not cycle ambiguous (it is cycle-unambiguous).

In [5]:
a.is_cycle_ambiguous()
Out[5]:
False
In [6]:
a = vcsn.context("lal_char(abc), b").ladybird(3)
a
Out[6]:
%3 I0 0 0 I0->0 F0 0->F0 1 1 0->1 a 1->0 c 1->1 b, c 2 2 1->2 a 2->0 a, c 2->2 b, c

Two cycles in $0$ with label "acac".

In [7]:
a.is_cycle_ambiguous()
Out[7]:
True
In [8]:
%%automaton -s a
vcsn_context = "lal_char, b"
$ -> 0
0 -> $
0 -> 1 a
0 -> 2 a
1 -> 0 b
1 -> 3 b
2 -> 1 c
2 -> 2 b
3 -> 1 c
%3 I0 0 0 I0->0 F0 0->F0 1 1 0->1 a 2 2 0->2 a 1->0 b 3 3 1->3 b 2->1 c 2->2 b 3->1 c

Two cycles in $0$ with label "babc".

In [9]:
a.is_cycle_ambiguous()
Out[9]:
True
In [10]:
%%automaton -s a
$ -> 0
0 -> $
1 -> 2 a
1 -> 3 a
2 -> 1 b
3 -> 1 b
%3 I0 0 0 I0->0 F0 0->F0 1 1 2 2 1->2 a 3 3 1->3 a 2->1 b 3->1 b
In [11]:
a.is_cycle_ambiguous()
Out[11]:
True