Shuffle product of words

class sage.combinat.words.shuffle_product.ShuffleProduct_overlapping(w1, w2)

Bases: sage.combinat.combinat.CombinatorialClass

EXAMPLES:

sage: from sage.combinat.words.shuffle_product import ShuffleProduct_overlapping
sage: w, u = map(Words("abcdef"), ["ab", "cd"])
sage: S = ShuffleProduct_overlapping(w,u)
sage: S == loads(dumps(S))
True
class sage.combinat.words.shuffle_product.ShuffleProduct_overlapping_r(w1, w2, r)

Bases: sage.combinat.combinat.CombinatorialClass

EXAMPLES:

sage: from sage.combinat.words.shuffle_product import ShuffleProduct_overlapping_r
sage: w, u = map(Words("abcdef"), ["ab", "cd"])
sage: S = ShuffleProduct_overlapping_r(w,u,1)
sage: S == loads(dumps(S))
True
class sage.combinat.words.shuffle_product.ShuffleProduct_shifted(w1, w2)

Bases: sage.combinat.words.shuffle_product.ShuffleProduct_w1w2

Shifted shuffle product of w1 with w2.

This is the shuffle product of w1 with the word obtained by adding the length of w1 to every letter of w2.

Note that this class is meant to be used for words; it misbehaves when w1 is a permutation or composition.

EXAMPLES:

sage: from sage.combinat.words.shuffle_product import ShuffleProduct_shifted
sage: w, u = Word([1,2]), Word([3,4])
sage: S = ShuffleProduct_shifted(w,u)
sage: S == loads(dumps(S))
True
class sage.combinat.words.shuffle_product.ShuffleProduct_w1w2(w1, w2)

Bases: sage.combinat.combinat.CombinatorialClass

EXAMPLES:

sage: from sage.combinat.words.shuffle_product import ShuffleProduct_w1w2
sage: W = Words([1,2,3,4])
sage: s = ShuffleProduct_w1w2(W([1,2]),W([3,4]))
sage: s == loads(dumps(s))
True
cardinality()

Returns the number of words in the shuffle product of w1 and w2.

It is given by binomial(len(w1)+len(w2), len(w1)).

EXAMPLES:

sage: from sage.combinat.words.shuffle_product import ShuffleProduct_w1w2
sage: w, u = map(Words("abcd"), ["ab", "cd"])
sage: S = ShuffleProduct_w1w2(w,u)
sage: S.cardinality()
6

Previous topic

Combinatorial classes of words.

Next topic

Suffix Tries and Suffix Trees

This Page