lyndon_factorization(self) method of sage.combinat.words.word.FiniteWord_over_OrderedAlphabet instance
Returns the Lyndon factorization of self.
 
The \emph{Lyndon factorization} of a finite word $w$ is the unique
factorization of $w$ as a non-increasing product of Lyndon words,
i.e., $w = l_1\cdots l_n$ where each $l_i$ is a Lyndon word and
$l_1\geq \cdots \geq l_n$. See for instance [1].
    
OUTPUT:
    list -- the list of factors obtained
 
EXAMPLES:
    sage: Words('01')('010010010001000').lyndon_factorization()
    (01.001.001.0001.0.0.0)
    sage: Words('10')('010010010001000').lyndon_factorization()
    (0.10010010001000)
    sage: Words('ab')('abbababbaababba').lyndon_factorization()
    (abb.ababb.aababb.a)
    sage: Words('ba')('abbababbaababba').lyndon_factorization()
    (a.bbababbaaba.bba)
 
TESTS:
    sage: Words('01')('01').lyndon_factorization()
    (01)
    sage: Words('10')('01').lyndon_factorization()
    (0.1)
    sage: lynfac = Words('ab')('abbababbaababba').lyndon_factorization()
    sage: map(lambda x:x.is_lyndon(), lynfac)
    [True, True, True, True]
    sage: lynfac = Words('ba')('abbababbaababba').lyndon_factorization()
    sage: map(lambda x:x.is_lyndon(), lynfac)
    [True, True, True]
 
REFERENCES:
    [1] J.-P. Duval, Factorizing words over an ordered alphabet,
    J. Algorithms 4 (1983) 363--381.