automaton.accessible

Create a new automaton from the accessible part of the input, i.e., the subautomaton whose states can be reached from an initial state.

Preconditions:

  • None

Postconditions:

  • Result.is_accessible()

See also:

Examples

In [1]:
import vcsn

The following automaton has states that cannot be reached from the initial(s) states:

In [2]:
%%automaton a dot
digraph
{
  vcsn_context = "lal_char(abc), b"
  I -> 0
  0 -> 1 [label = "a"]
  1 -> F
  i -> 0 [label = "a"]
  1 -> f [label = "a"]
}
%3 I0 0 0 I0->0 F1 1 1 0->1 a 1->F1 3 3 1->3 a 2 2 2->0 a
In [3]:
a.is_accessible()
Out[3]:
False

Calling accessible returns a copy of the automaton without non-accessible states:

In [4]:
a.accessible()
Out[4]:
%3 I0 0 0 I0->0 F1 1 1 0->1 a 1->F1 2 2 1->2 a
In [5]:
a.accessible().is_accessible()
Out[5]:
True