# Constructing all NE-lattice paths from $(0,0)$ to $(m,n)$

If I consider only Dyck Paths, I can do write something like this:

DWS=DyckWords(3).list()
for D in DWS:
print(D.height())


to obtain the height of all Dyck paths of length $3$. However, I would like to do the same thing but using $NE$-lattice paths from $(0,0)$ to $(m,n)$. Is there an easy way to do this in Sage?

edit retag close merge delete

1

You could try using a bijection with something that is in Sage, e.g. see Ferrers diagram of a partition.

( 2019-04-11 02:43:27 -0500 )edit

Sort by » oldest newest most voted

I fixed this myself but in case anyone is interested I will leave this as an answer.

I decided to use the kbits from this thread to generate all binary strings of length $n$ with $m$ ones. Such strings are in a natural bijection with $NE$-lattice paths from $(0,0)$ to $(n,m)$. After that, I can get the heights of all the paths by writing

Paths = WordPaths('01', steps=[(1,-1),(1,1)])

for b in kbits(m+n,m):
print(Paths(b).ymax())


Note: Sage has a "height" function on words, but this is not what I am looking for. In the definition of height that I am using, the height of an $NE$-path is geometrically the biggest distance that the path is away from the main diagonal.

more