Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to compute the set of Dyck paths ?

I am new to SAGE and try to experiment with it. So I apologize if my question is too trivial. I am interested to do Dyck paths with SAGE. I understand that

D=DyckWords(n)

D.list()

gives Dyck words as 2n-tuples of n numbers 0,1. But I want to get the corresponding Dyck paths by replacing 1 with an up-step (1,1) and 0 with a down-step (1,-1) represented by the (2n+1)-tuple of the heights of the path.

Thus instead of w=[1,1,1,0,0,1,0,0] I want d=[0,1,2,3,2,1,2,1,0] with height h(d)=3.

How do I get this? And how to compute the height of the path? More precisely how to compute the set of all (d,h(d))for d in D?