NonDecreasing Parking Functions¶
A nondecreasing parking function of size \(n\) is a nondecreasing function \(f\) from \(\{1,\dots,n\}\) to itself such that for all \(i\), one has \(f(i) \leq i\).
The number of nondecreasing parking functions of size \(n\) is the \(n\)th
Catalan number
.
The set of nondecreasing parking functions of size \(n\) is in bijection with
the set of Dyck words
of size \(n\).
AUTHORS:
 Florent Hivert (200904)
 Christian Stump (201211) added pretty printing

class
sage.combinat.non_decreasing_parking_function.
NonDecreasingParkingFunction
(lst)¶ Bases:
sage.structure.element.Element
A non decreasing parking function of size \(n\) is a nondecreasing function \(f\) from \(\{1,\dots,n\}\) to itself such that for all \(i\), one has \(f(i) \leq i\).
EXAMPLES:
sage: NonDecreasingParkingFunction([]) [] sage: NonDecreasingParkingFunction([1]) [1] sage: NonDecreasingParkingFunction([2]) Traceback (most recent call last): ... ValueError: [2] is not a nondecreasing parking function sage: NonDecreasingParkingFunction([1,2]) [1, 2] sage: NonDecreasingParkingFunction([1,1,2]) [1, 1, 2] sage: NonDecreasingParkingFunction([1,1,4]) Traceback (most recent call last): ... ValueError: [1, 1, 4] is not a nondecreasing parking function

classmethod
from_dyck_word
(dw)¶ Bijection from
Dyck words
. It is the inverse of the bijectionto_dyck_word()
. You can find there the mathematical definition.EXAMPLES:
sage: NonDecreasingParkingFunction.from_dyck_word([]) [] sage: NonDecreasingParkingFunction.from_dyck_word([1,0]) [1] sage: NonDecreasingParkingFunction.from_dyck_word([1,1,0,0]) [1, 1] sage: NonDecreasingParkingFunction.from_dyck_word([1,0,1,0]) [1, 2] sage: NonDecreasingParkingFunction.from_dyck_word([1,0,1,1,0,1,0,0,1,0]) [1, 2, 2, 3, 5]

to_dyck_word
()¶ Implement the bijection to
Dyck words
, which is defined as follows. Take a non decreasing parking function, say [1,1,2,4,5,5], and draw its graph:___  . 5 _ . 5 ___ . . 4 _ . . . . 2  . . . . . 1  . . . . . 1
The corresponding Dyck word [1,1,0,1,0,0,1,0,1,1,0,0] is then read off from the sequence of horizontal and vertical steps. The converse bijection is
from_dyck_word()
.EXAMPLES:
sage: NonDecreasingParkingFunction([1,1,2,4,5,5]).to_dyck_word() [1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0] sage: NonDecreasingParkingFunction([]).to_dyck_word() [] sage: NonDecreasingParkingFunction([1,1,1]).to_dyck_word() [1, 1, 1, 0, 0, 0] sage: NonDecreasingParkingFunction([1,2,3]).to_dyck_word() [1, 0, 1, 0, 1, 0] sage: NonDecreasingParkingFunction([1,1,3,3,4,6,6]).to_dyck_word() [1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0]

classmethod

sage.combinat.non_decreasing_parking_function.
NonDecreasingParkingFunctions
(n=None)¶ Return the set of NonDecreasing Parking Functions.
A nondecreasing parking function of size \(n\) is a nondecreasing function \(f\) from \(\{1,\dots,n\}\) to itself such that for all \(i\), one has \(f(i) \leq i\).
EXAMPLES:
Here are all thenon decreasing parking functions of size 5:
sage: NonDecreasingParkingFunctions(3).list() [[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]]
If no size is specified, then NonDecreasingParkingFunctions returns the set of all nondecreasing parking functions.
sage: PF = NonDecreasingParkingFunctions(); PF Nondecreasing parking functions sage: [] in PF True sage: [1] in PF True sage: [2] in PF False sage: [1,1,3] in PF True sage: [1,1,4] in PF False
If the size \(n\) is specified, then NonDecreasingParkingFunctions returns the set of all nondecreasing parking functions of size \(n\).
sage: PF = NonDecreasingParkingFunctions(0) sage: PF.list() [[]] sage: PF = NonDecreasingParkingFunctions(1) sage: PF.list() [[1]] sage: PF = NonDecreasingParkingFunctions(3) sage: PF.list() [[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]] sage: PF3 = NonDecreasingParkingFunctions(3); PF3 Nondecreasing parking functions of size 3 sage: [] in PF3 False sage: [1] in PF3 False sage: [1,1,3] in PF3 True sage: [1,1,4] in PF3 False

class
sage.combinat.non_decreasing_parking_function.
NonDecreasingParkingFunctions_all
¶ Bases:
sage.structure.unique_representation.UniqueRepresentation
,sage.structure.parent.Parent

class
sage.combinat.non_decreasing_parking_function.
NonDecreasingParkingFunctions_n
(n)¶ Bases:
sage.structure.unique_representation.UniqueRepresentation
,sage.structure.parent.Parent
The combinatorial class of nondecreasing parking functions of size \(n\).
A nondecreasing parking function of size \(n\) is a nondecreasing function \(f\) from \(\{1,\dots,n\}\) to itself such that for all \(i\), one has \(f(i) \leq i\).
The number of nondecreasing parking functions of size \(n\) is the \(n\)th Catalan number.
EXAMPLES:
sage: PF = NonDecreasingParkingFunctions(3) sage: PF.list() [[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]] sage: PF = NonDecreasingParkingFunctions(4) sage: PF.list() [[1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 1, 3], [1, 1, 1, 4], [1, 1, 2, 2], [1, 1, 2, 3], [1, 1, 2, 4], [1, 1, 3, 3], [1, 1, 3, 4], [1, 2, 2, 2], [1, 2, 2, 3], [1, 2, 2, 4], [1, 2, 3, 3], [1, 2, 3, 4]] sage: [ NonDecreasingParkingFunctions(i).cardinality() for i in range(10)] [1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862]
Warning
The precise order in which the parking function are generated or listed is not fixed, and may change in the future.
AUTHORS:
 Florent Hivert

Element
¶ alias of
NonDecreasingParkingFunction

cardinality
()¶ Return the number of nondecreasing parking functions of size \(n\).
This number is the \(n\)th
Catalan number
.EXAMPLES:
sage: PF = NonDecreasingParkingFunctions(0) sage: PF.cardinality() 1 sage: PF = NonDecreasingParkingFunctions(1) sage: PF.cardinality() 1 sage: PF = NonDecreasingParkingFunctions(3) sage: PF.cardinality() 5 sage: PF = NonDecreasingParkingFunctions(5) sage: PF.cardinality() 42

one
()¶ Return the unit of this monoid.
This is the nondecreasing parking function [1, 2, …, n].
EXAMPLES:
sage: ndpf = NonDecreasingParkingFunctions(5) sage: x = ndpf.random_element(); x # random sage: e = ndpf.one() sage: x == e*x == x*e True

random_element
()¶ Return a random parking function of the given size.
EXAMPLES:
sage: ndpf = NonDecreasingParkingFunctions(5) sage: x = ndpf.random_element(); x # random [1, 2, 2, 4, 5] sage: x in ndpf True

sage.combinat.non_decreasing_parking_function.
is_a
(x, n=None)¶ Check whether a list is a nondecreasing parking function.
If a size \(n\) is specified, checks if a list is a nondecreasing parking function of size \(n\).