Combinatorics of nondeterministic walks of the Dyck and Motzkin type

by   Élie De Panafieu, et al.

This paper introduces nondeterministic walks, a new variant of one-dimensional discrete walks. At each step, a nondeterministic walk draws a random set of steps from a predefined set of sets and explores all possible extensions in parallel. We introduce our new model on Dyck steps with the nondeterministic step set --1, 1, --1, 1 and Motzkin steps with the nondeterministic step set --1, 0, 1, --1, 0, --1, 1, 0, 1, --1, 0, 1. For general lists of step sets and a given length, we express the generating function of nondeterministic walks where at least one of the walks explored in parallel is a bridge (ends at the origin). In the particular cases of Dyck and Motzkin steps, we also compute the asymptotic probability that at least one of those parallel walks is a meander (stays nonnegative) or an excursion (stays nonnegative and ends at the origin). This research is motivated by the study of networks involving encapsulations and decapsulations of protocols. Our results are obtained using generating functions and analytic combinatorics.



There are no comments yet.


page 1

page 2

page 3

page 4


Hypergeometric Expressions for Generating Functions of Walks with Small Steps in the Quarter Plane

We study nearest-neighbors walks on the two-dimensional square lattice, ...

Arcsine laws for random walks generated from random permutations with applications to genomics

A classical result for the simple symmetric random walk with 2n steps is...

Efficient and Local Parallel Random Walks

Random walks are a fundamental primitive used in many machine learning a...

On the Search Efficiency of Parallel Lévy Walks on Z^2

Lévy walk is a popular movement model where an agent repeatedly samples ...

Analytic Combinatorics in Several Variables: Effective Asymptotics and Lattice Path Enumeration

The field of analytic combinatorics, which studies the asymptotic behavi...

The Search Efficiency of Intermittent Lévy walks Optimally Scales with Target Size

We address the general question of what is the best strategy to employ w...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In recent years lattice paths have received a lot of attention in different fields, such as probability theory, computer science, biology, chemistry, physics, and much more 

[11, 9, 5]. One reason for that is their versatility as models like e.g., the up-to-date model of certain polymers in chemistry [16]. In this paper we introduce yet another application: the encapsulation of protocols over networks. To achieve this goal we generalize the class of lattice paths to so called nondeterministic lattice paths.

1.1 Definitions

Classical walks.

We mostly follow terminology from [2]. Given a set of integers, called the steps, a walk is a sequence of steps . In this paper we will always assume that our walks start at the origin. Its length is the number of its steps, and its endpoint is equal to the sum of the steps . As illustrated in Figure (a)a, a walk can be visualized by its geometric realization. Starting from the origin, the steps are added one by one to the previous endpoints. This gives a sequence of ordinates at discrete time steps, such that and A bridge is a walk with endpoint . A meander is a walk where all points have nonnegative ordinate, i.e., for all . An excursion is a meander with endpoint .

Nondeterministic walks.

This paper investigates a new variant of walks, called nondeterministic walks, or N-walks. In our context, this word does not mean “random

”. Instead it is understood in the same sense as for automata and Turing machines. A process is nondeterministic if several branches are explored in parallel, and the process is said to end in an accepting state if one of those branches ends in an accepting state. Let us now give a precise definition of these walks.

[Nondeterministic walks] An N-step is a nonempty set of integers. Given an N-step set , an N-walk is a sequence of N-steps. Its length is equal to the number of its N-steps.

As for classical walks we always assume that they start at the origin and we distinguish different types.

[Types of N-walks] An N-walk and a classical walk are compatible if they have the same length , the same starting point, and for each , the step is included in the N-step, i.e., . An N-bridge (resp. N-meander, resp. N-excursion) is an N-walk compatible with at least one bridge (resp. meander, resp. excursion). Thus, N-excursions are particular cases of N-meanders.

The endpoints of classical walks are central to the analysis. We define their nondeterministic analogues.

[Reachable points] The reachable points of a general N-walk are the endpoints of all walks compatible with it. For N-meanders, the reachable points are defined as the set of endpoints of compatible meanders. In particular, all reachable endpoints of an N-meander are nonnegative. The minimum (resp. maximum) reachable point of an N-walk is denoted by (resp. ). The minimum (resp. maximum) reachable point of an N-meander is denoted by (resp. ). The geometric realization of an N-walk is the sequence, for from to , of its reachable points after steps. Figure 1 illustrates the geometric realization of a walk in ((a)a), of an N-walk in ((b)b), and of the classical meanders compatible with in ((c)c). Note that the walk (highlighted in red) is compatible with the N-walk .















(a) A classical walk.















(b) An N-walk.















(c) Meanders compatible with the N-walk.
Figure 1: Geometric realization of a walk, an N-walk, and its compatible meanders.


Any set of weights, and in particular any probability distribution on the set of steps or N-steps induces a probability distribution on walks or N-walks. The probability associated to the walk or N-walk

is then the product of the probabilities of its steps or N-steps.

1.2 Main results

Our main results are the analysis of the asymptotic number of nondeterministic walks of the Dyck and Motzkin type with step sets and , respectively. The results for the unweighted case where all weights are set equal to one are summarized in Table 1. These results are derived using generating functions and singularity analysis. The reappearing phenomenon is the one of a simple dominating polar singularity arising from the large redundancy in the steps. The type of N-walk only influences the constant or the proportion among all N-walks. The lower order terms are exponentially smaller and of the square root type. These are much more influenced by the types. From a combinatorial point of view, we see a quite different behavior compared with classical paths. In particular, the limit probabilities for a Dyck N-walk of even length to be an N-bridge, an N-meander, or an N-excursion, are , , or , and for Motzkin N-walks , , or .

We also explore general N-steps and prove that the generating function of N-bridges is always algebraic. N-excursions with general N-steps will be investigated in a longer version of this article.

Type Dyck N-steps Motzkin N-steps
Table 1: The asymptotic number of nondeterministic unweighted (all weights equal to ) Dyck and Motzkin N-walks with steps obeying different constraints: N-Bridges contain at least one classical bridge ending at , N-Meanders contain at least one classical meander staying nonnegative, and N-excursions contain at least one classical excursion staying nonnegative and ending at . The constant is an algebraic number defined as the positive real solution of .

1.3 Motivation and related work

Let us start with a vivid motivation of the model using Russian dolls. Suppose we have a set of people arranged in a line. There are three kinds of people. A person of the first kind is only able to put a received doll in a bigger one. A person of the second kind is only able to extract a smaller doll (if any) from a bigger one. If she receives the smallest doll, then she throws it away. Finally, a person of the third kind can either put a doll in a bigger one or extract a smaller doll if any. We want to know if it is possible for the last person to receive the smallest doll after it has been given to the first person and then, consecutively, handed from person to person while performing their respective operations. This is equivalent to asking if a given N-walk with each N-step is an N-excursion, i.e., if the N-walk is compatible with at least one excursion. The probabilistic version of this question is: what is the probability that the last person can receive the smallest doll according to some distribution on the set of people over the three kinds?

Networks and encapsulations.

The original motivation of this work comes from networking. In a network, some nodes are able to encapsulate protocols (put a packet of a protocol inside a packet of another one), decapsulate protocols (extract a nested packet from another one), or perform any of these two operations (albeit most nodes are only able to transmit packets as they receive them). Typically, a tunnel is a subpath starting with an encapsulation and ending with the corresponding decapsulation. Tunnels are very useful for achieving several goals in networking (e.g., interoperability: connecting IPv6 networks across IPv4 ones [19]; security and privacy: securing IP connections [18], establishing Virtual Private Networks [17], etc.). Moreover, tunnels can be nested to achieve several goals. Replacing the Russian dolls by packets, it is easy to see that an encapsulation can be modeled by a step and a decapsulation by a , while a passive transmission of a packet is modeled by a step.

Given a network with some nodes that are able to encapsulate or decapsulate protocols, a path from a sender to a receiver is feasible if it allows the latter to retrieve a packet exactly as dispatched by the sender. Computing the shortest feasible path between two nodes is polynomial [12] if cycles are allowed without restriction. In contrast, the problem is -hard if cycles are forbidden or arbitrarily limited. In [12], the algorithms are compared through worst-case complexity analysis and simulation. The simulation methodology for a fixed network topology is to make encapsulation (resp. decapsulation) capabilities available with some probability and observe the processing time of the different algorithms. It would be interesting, for simulation purposes, to generate random networks with a given probability of existence of a feasible path between two nodes. This work is the first step towards achieving this goal, since our results give the probability that any path is feasible (i.e., is a N-excursion) according to a probability distribution of encapsulation and decapsulation capabilities over the nodes.

Lattice paths.

Nondeterministic walks naturally connect between lattice paths and branching processes. This is underlined by our usage of many well-established analytic and algebraic tools previously used to study lattice paths. In particular, those are the robustness of D-finite functions with respect to the Hadamard product, and the kernel method [7, 4, 2].

The N-walks are nondeterministic one-dimensional discrete walks. We will see that their generating functions require three variables: one marking the lowest point that can be reached by the N-walk , another one marking the highest point , and the last one marking its length . Hence, they are also closely related to two-dimensional lattice paths, if we interpret as coordinates in the plane.

2 Dyck N-walks

The step set of classical Dyck paths is . The N-step set of all nonempty subsets is

and we call the corresponding N-walks Dyck N-walks. To every step we associate a weight or probability , and , respectively.

Example 2.1 (Dyck -walks)

Let us consider the Dyck N-walk The sequence of its reachable points is . There are classical walks compatible with it:

Classical walk Geometric realization
(sequence of steps) (ordinates)

There are two bridges, which happen to be excursions. Thus, is an N-bridge and an N-excursion.

The set of reachable points of a Dyck N-walk or N-meander has the following particular structure.

The reachable points of a Dyck N-walk are where , , and the length of have the same parity. The same result holds for Dyck N-meanders, with and replaced by and (see Definition 1.1).

We define the generating functions , , of Dyck N-walks and Dyck N-meanders as

Note that by construction these are power series in with Laurent polynomials in and , as each of the finitely many N-walks of length has a finite minimum and maximum reachable point.

One difference to classical lattice paths is the choice of the catalytic variables and . Here, they encode the minimum and the maximum reachable points, while in classical problems one chooses to keep track of the coordinates of the endpoint, (see [2], for example).

2.1 Dyck N-meanders and N-excursions

As a direct corollary of Lemma 2.1, all N-bridges and N-excursions have even length. The total number of Dyck N-bridges and Dyck N-excursions are then, respectively, given by

where the coefficient extraction operator is defined as and the nonpositive part extraction operator is defined as (and analogously for ).

The generating function of Dyck N-meanders is characterized by the relation

Applying the symbolic method (see [7]), we translate the following combinatorial characterization of N-meanders into the claimed equation. An N-meander is either of length , or it can be uniquely decomposed into an N-meander followed by an N-step. If is nonzero, then any N-step can be applied. The generating function of N-meanders with positive minimum reachable point is . If vanishes, but is nonzero (those N-meanders have generating function ), then an additional N-step increases (the path ending at  disappears, and the one ending at  becomes the minimum) and decreases , while an additional N-step or increases both and . Finally, if and vanish, which corresponds to the generating function , then the N-step is forbidden, and the two other available N-steps both increase and .

Let us introduce the min-max-change polynomial and the kernel as

The generating function of Dyck N-walks has now the compact form . A key role in the following result on the closed form of Dyck N-meanders is played by and , the unique power series solutions satisfying , and which are given by

The generating function of Dyck -meanders is algebraic of degree , and equal to

The generating function of Dyck N-excursions is symmetric in and , and equal to

Starting from the result of Proposition 2.1 one first substitutes and finds a closed-form expression for using the kernel method. After substituting this expression back into the initial equation one applies the kernel method again with respect to and finds a closed-form solution for . Combining these results one proves the claim. Finally, using a computer algebra system a short computation using the closed form of Dyck N-excursions shows the symmetry in and .

It would be desirable to find a combinatorial interpretation of the surprising symmetry in and of Dyck N-excursions (which is clear for Dyck N-bridges).

With this result, we can easily answer the counting problem in which all weights are set equal to one. Thereby we also solve a conjecture in the OEIS111The on-line encyclopedia of integer sequences: on the asymptotic growth.

For the generating function of unweighted Dyck N-meanders is

The number of unweighted Dyck N-meanders is asymptotically equal to

These N-walks are in bijection with walks in the first quadrant starting at and consisting of steps . The counting sequence is given by OEIS A151281.

For the complete generating function of unweighted Dyck N-excursions is

The number of unweighted Dyck N-excursions is asymptotically equal to

Finally, we come back to one of the starting questions from the networking motivation.

The probability for a random Dyck N-walk of length to be an N-excursion has for the following asymptotic form where the roles of and are interchangeable:

  • if ,

  • if and ,

  • if ,

  • if and

Starting from the results of Theorem 2.1 we perform a singularity analysis [7]. Thereby different regimes need to be considered, leading to the different cases in the result. In the last case the condition guarantees that is closer to than .

Note that the (huge) formula for the constant in the last case can be made explicit in terms of and . However, it is of different shape for , and . In Figure 2 we compare the theoretical results with simulations for three different probability distributions. These nicely exemplify three of the four possible regimes of convergence.

Path length(simulation)(th. expec.)(simulations)(th. expec.)(simulations)(th. expec.)
(a) Short paths (from to )
Path length(simulations)(th. expec.)
(b) Long paths (from to )
Figure 2: Comparison of theoretical expectation and averaged simulation (over runs) of the proportion of Dyck N-excursions among Dyck N-walks.

2.2 Dyck N-bridges

We now turn our attention to Dyck N-bridges. Their generating function is defined as

Recall the following relation with all N-walks (note that bridges have to be of even length): In the following theorem we will reveal a great contrast to classical walks: nearly all N-walks are N-bridges.

The generating function of Dyck N-bridges is algebraic of degree . For the generating function of unweighted Dyck N-bridges is algebraic of degree :

The number of unweighted Dyck N-bridges is asymptotically equal to

In order to improve readability we drop the parity condition on and define

such that


It is then simple to recover from . In words, an N-bridge is an N-walk of even length whose minimum is not strictly positive, nor is its maximum strictly negative222We thank Mireille Bousquet-Mélou for suggesting us this approach..

The change in the - (minimal reachable point) and -coordinate (maximal reachable point) can be conveniently encoded in the min-max-change polynomial

Then, the construction can be interpreted as the one of two-dimensional walks of length , starting at , with the step set , and ending in the fourth quadrant . A lot is known about these walks, see e.g., [4]. By (1) it suffices to find the generating functions and for -walks ending with a positive abscissa (resp. negative ordinate). The theory of formal Laurent series with positive coefficients tells us automatically that they are algebraic, which implies that the generating function of bridges is algebraic, see e.g., [8, Section 6] which also gives further historical references.

Due to the symmetry of the step set we have after additionally interchanging the role of and . In order to end the proof it remains to compute the roots of the denominator of and perform a partial fraction decomposition.

After this detailed discussion of nondeterministic walks derived from Dyck paths, we turn to the probably next most classical lattice paths: Motzkin paths.

3 Motzkin N-walks

The step set of classical Motzkin paths is . The N-step set of all nonempty subsets is

and we call the corresponding N-walks Motzkin N-walks. A Motzkin N-walk is said to be

  • of type if is equal to ,

  • of type if is equal to and .

The following proposition explains how these two types are sufficient to characterize the structure of Motzkin N-walks.

A Motzkin N-walk is of type if and only if it is constructed only from the N-steps , , , and . Otherwise, it is of type .

The proof is based on a recurrence and a case-by-case analysis on the number and type of N-steps.

The set of Motzkin N-walks of type (resp. ) is denoted by (resp. ), and their generating functions are defined as

The generating functions of Motzkin N-walks of type and are rational. The generating function of Motzkin N-bridges is algebraic.

The first statement is a direct corollary of the previous proposition due to a simple sequence construction. An N-bridge of type is an N-walk that satisfies , , and is even. Note that in this case this property is not equivalent to an even number of steps. An N-bridge of type is an N-walk that satisfies and . Thus, the generating function of Motzkin N-bridges is equal to

Since the generating functions of and are rational, according to [4, Proposition 1] (see also [13]), the generating function of N-bridges is D-finite. Yet the generating function is even algebraic, which can be proved similarly as done the proof of Theorem 2.2.

Using a computer algebra system it is easy to get closed-form solutions and asymptotics for specific values of the weights. We do not give these closed forms, as they are quite large and do not shed new light on the problem. It is however interesting to compute the asymptotic proportion of N-bridges among all N-walks. For example, when all weights are set to , it is equal to

Hence, nearly all N-walks are N-bridges.

We now turn to the analysis of Motzkin N-meanders and N-excursions.

The generating functions of Motzkin N-meanders and N-excursions are algebraic.

Without loss of generality we perform all computations here with all weights . Let and denote the Motzkin N-meanders of type and . Their generating functions are

Let also

denote the column vector

. An N-meander is either empty – in which case, it is of type – or it is an N-meander followed by an N-step . The type of depends on the type of , the N-step , as well as on the case if or if . Specifically,

  • when has type , then has type if , otherwise it has type ,

  • when has type and then has type for any ,

  • when has type and (i.e. the reachable points are ) then has type if , and type otherwise.

Applying the Symbolic Method [7] and the same reasoning as in the proof of Proposition 2.1, we obtain the following system of equations characterizing the generating functions from the vector

where is the column vector , and , , are two-by-two matrices with Laurent polynomials in and given in Figure 3. Observe that the first two matrices are upper-triangular.

Figure 3: Matrices involved in the proof of Theorem 3.

This equation is rearranged into


Next, we apply the kernel method (see e.g., [2] and [1]) successively on and in a two phases to compute the generating function of Motzkin N-meanders. The small roots in the variable of the equations

are denoted by and , and are equal to

We then define the row vectors

so that the left-hand side of Equation (2) vanishes both when evaluated at and left-multiplied by , and also when evaluated at and left-multiplied by . Combining the corresponding two right-hand sides, we obtain a new two-by-two system of linear equations


where the vector of size has its first element equal to , and its second element equal to

and the two-by-two matrices and are two large to be shown here. Again, the matrix is upper-triangular. We now define

and the row vectors

to ensure that and have series expansions at the origin, and that the left-hand side of Equation (3) vanishes both when evaluated at and left-multiplied by , and also when evaluated at and left-multiplied by . The corresponding two right-hand side are combined to form a new two-by-two system of equations

where the column vector and the matrix are too large to be shown here. The matrix is invertible, so the generating function of Motzkin N-meanders with maximum reachable point is equal to

This expression is injected in Equation (3) to express the generating function of Motzkin N-meanders with minimum reachable point

Finally, this expression is injected in Equation (2) to express the generating function of Motzkin N-meanders

The generating function of N-meanders and N-excursions are then, respectively, and .

As before we can use a computer algebra system to get numeric results. After tedious computations one gets that for all ’s equal to the generating function of N-meanders is algebraic of degree and given by

The total number of N-meanders is asymptotically equal to

The generating function of N-excursions is algebraic of degree . Their asymptotic number is