lightest: insuffisant preconditions
This is wrong:
In [16]: %%automaton a
....: context = "lal_char, q"
....: $ -> 0
....: 0 -> 1 <2>a
....: 1 -> 2 <1/10>a
....: 0 -> 2 a
....: 2 -> $
....:
name_automaton<mutable_automaton<context<letterset<char_letters>, q>>>
In [17]: a.lightest(1)
Out[17]: a
In [18]: a.lightest(2)
Out[18]: a + <1/5>aa
and this too:
In [19]: %%automaton a
context = "lal_char, z"
$ -> 0
0 -> 1 <2>a
1 -> 2 <-10>a
0 -> 2 a
2 -> $
....:
name_automaton<mutable_automaton<context<letterset<char_letters>, z>>>
In [20]: a.lightest(1)
Out[20]: a
In [21]: a.lightest(2)
Out[21]: a + <-20>aa
You are missing important preconditions to call dijkstra.
Once this is fixed, you need to revise the implementation of the "auto"
algorithm: it cannot be just "dijkstra"
, it depends on the feature of the automaton. Also, I'd like to be able to control the algorithm used by lightest
from Python. Today, we can't. This way, I could have use the lightest_impl
implementation which is similar to shortest
even for num = 1, to show that in that case it was right.