Ask Your Question

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

asked 2019-04-11 08:50:27 +0200

joakim_uhlin gravatar image

updated 2019-04-11 08:51:20 +0200

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

for D in DWS:

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 flag offensive close merge delete



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

rburing gravatar imagerburing ( 2019-04-11 09:43:27 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-11 15:33:37 +0200

joakim_uhlin gravatar image

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):

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-04-11 08:50:27 +0200

Seen: 365 times

Last updated: Apr 11 '19