Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 45899
Kernel: Python 3

automaton.lightest_automaton(num=1, algo="auto")

Return an automaton containing only the transitions and states from the lightest path in automaton.

Arguments:

  • num the number of paths in the resulting automaton (there might be fewer).

  • algo the algorithm name.

The algorithm can be:

  • "auto": uses "dijkstra" implementation if the weightset cannot have lightening weights (for example Nmin\mathbb{N}_{\text{min}}), "bellman-ford" otherwise.

  • "a-star"

  • "bellman-ford"

  • "dijkstra"

  • "yen" : the only algorithm that can be used when trying to retrieve multiple paths, the algorithm does not count loops as possible paths.

Preconditions:

  • "dijkstra": automaton must be tropical.

See also:

Examples

import vcsn
%%automaton --strip aut context = "lal_char, nmin" $ -> 0 0 -> 1 <6>a 0 -> 2 <1>a 2 -> 3 <1>b 3 -> 3 <2>b 3 -> 4 <1>c 4 -> 1 <1>d 0 -> 5 <2>a 5 -> 1 <3>b 1 -> $
Image in a Jupyter notebook
aut.lightest_automaton()
Image in a Jupyter notebook
aut.lightest_automaton(1, "bellman-ford")
Image in a Jupyter notebook