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

automaton.weight_series

Compute the sum of all the weights of the behavior. Find weighted distance between initial and final states.

Implementations:

  • With a tropical weightset: Shortest path algorithm.

  • Otherwise: Proper applied to the spontaneous version of the automaton, i.e., as if all the labels were replaced by the empty word.

Examples

import vcsn

In a Tropical Semiring

%%automaton a context = "lal_char, zmin" $ -> 0 0 -> 1 <6>a 0 -> 2 <1>a 2 -> 3 <1>b 3 -> 4 <1>c 4 -> 1 <1>d 0 -> 5 <2>a 5 -> 1 <3>b 1 -> $
Image in a Jupyter notebook
a.weight_series()

44

In Q\mathbb{Q}

%%automaton b context = "lal_char, q" $ -> 0 0 -> 1 <6>a 0 -> 2 <1>a 2 -> 3 <1>b 3 -> 4 <1>c 4 -> 1 <1>d 0 -> 5 <2>a 5 -> 1 <3>b 1 -> $
Image in a Jupyter notebook
b.weight_series()

1313