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 uptodate 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 Nwalks. 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 Nstep is a nonempty set of integers. Given an Nstep set , an Nwalk is a sequence of Nsteps. Its length is equal to the number of its Nsteps.
As for classical walks we always assume that they start at the origin and we distinguish different types.
[Types of Nwalks] An Nwalk 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 Nstep, i.e., . An Nbridge (resp. Nmeander, resp. Nexcursion) is an Nwalk compatible with at least one bridge (resp. meander, resp. excursion). Thus, Nexcursions are particular cases of Nmeanders.
The endpoints of classical walks are central to the analysis. We define their nondeterministic analogues.
[Reachable points] The reachable points of a general Nwalk are the endpoints of all walks compatible with it. For Nmeanders, the reachable points are defined as the set of endpoints of compatible meanders. In particular, all reachable endpoints of an Nmeander are nonnegative. The minimum (resp. maximum) reachable point of an Nwalk is denoted by (resp. ). The minimum (resp. maximum) reachable point of an Nmeander is denoted by (resp. ). The geometric realization of an Nwalk 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 Nwalk in ((b)b), and of the classical meanders compatible with in ((c)c). Note that the walk (highlighted in red) is compatible with the Nwalk .
Probabilities.
Any set of weights, and in particular any probability distribution on the set of steps or Nsteps induces a probability distribution on walks or Nwalks. The probability associated to the walk or Nwalk
is then the product of the probabilities of its steps or Nsteps.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 Nwalk only influences the constant or the proportion among all Nwalks. 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 Nwalk of even length to be an Nbridge, an Nmeander, or an Nexcursion, are , , or , and for Motzkin Nwalks , , or .
We also explore general Nsteps and prove that the generating function of Nbridges is always algebraic. Nexcursions with general Nsteps will be investigated in a longer version of this article.
Type  Dyck Nsteps  Motzkin Nsteps 

NWalk  
NBridge  
NMeander  
NExcursion 
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 Nwalk with each Nstep is an Nexcursion, i.e., if the Nwalk 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 worstcase 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 Nexcursion) 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 wellestablished analytic and algebraic tools previously used to study lattice paths. In particular, those are the robustness of Dfinite functions with respect to the Hadamard product, and the kernel method [7, 4, 2].
The Nwalks are nondeterministic onedimensional discrete walks. We will see that their generating functions require three variables: one marking the lowest point that can be reached by the Nwalk , another one marking the highest point , and the last one marking its length . Hence, they are also closely related to twodimensional lattice paths, if we interpret as coordinates in the plane.
2 Dyck Nwalks
The step set of classical Dyck paths is . The Nstep set of all nonempty subsets is
and we call the corresponding Nwalks Dyck Nwalks. To every step we associate a weight or probability , and , respectively.
Example 2.1 (Dyck walks)
Let us consider the Dyck Nwalk 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 Nbridge and an Nexcursion.
The set of reachable points of a Dyck Nwalk or Nmeander has the following particular structure.
The reachable points of a Dyck Nwalk are where , , and the length of have the same parity. The same result holds for Dyck Nmeanders, with and replaced by and (see Definition 1.1).
We define the generating functions , , of Dyck Nwalks and Dyck Nmeanders as
Note that by construction these are power series in with Laurent polynomials in and , as each of the finitely many Nwalks 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 Nmeanders and Nexcursions
As a direct corollary of Lemma 2.1, all Nbridges and Nexcursions have even length. The total number of Dyck Nbridges and Dyck Nexcursions 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 Nmeanders is characterized by the relation
Applying the symbolic method (see [7]), we translate the following combinatorial characterization of Nmeanders into the claimed equation. An Nmeander is either of length , or it can be uniquely decomposed into an Nmeander followed by an Nstep. If is nonzero, then any Nstep can be applied. The generating function of Nmeanders with positive minimum reachable point is . If vanishes, but is nonzero (those Nmeanders have generating function ), then an additional Nstep increases (the path ending at disappears, and the one ending at becomes the minimum) and decreases , while an additional Nstep or increases both and . Finally, if and vanish, which corresponds to the generating function , then the Nstep is forbidden, and the two other available Nsteps both increase and .
Let us introduce the minmaxchange polynomial and the kernel as
The generating function of Dyck Nwalks has now the compact form . A key role in the following result on the closed form of Dyck Nmeanders 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 Nexcursions is symmetric in and , and equal to
Starting from the result of Proposition 2.1 one first substitutes and finds a closedform 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 closedform solution for . Combining these results one proves the claim. Finally, using a computer algebra system a short computation using the closed form of Dyck Nexcursions shows the symmetry in and .
It would be desirable to find a combinatorial interpretation of the surprising symmetry in and of Dyck Nexcursions (which is clear for Dyck Nbridges).
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 OEIS^{1}^{1}1The online encyclopedia of integer sequences: http://oeis.org/A151281. on the asymptotic growth.
For the generating function of unweighted Dyck Nmeanders is
The number of unweighted Dyck Nmeanders is asymptotically equal to
These Nwalks 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 Nexcursions is
The number of unweighted Dyck Nexcursions is asymptotically equal to
Finally, we come back to one of the starting questions from the networking motivation.
The probability for a random Dyck Nwalk of length to be an Nexcursion 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.
2.2 Dyck Nbridges
We now turn our attention to Dyck Nbridges. Their generating function is defined as
Recall the following relation with all Nwalks (note that bridges have to be of even length): In the following theorem we will reveal a great contrast to classical walks: nearly all Nwalks are Nbridges.
The generating function of Dyck Nbridges is algebraic of degree . For the generating function of unweighted Dyck Nbridges is algebraic of degree :
The number of unweighted Dyck Nbridges is asymptotically equal to
In order to improve readability we drop the parity condition on and define
such that
(1) 
It is then simple to recover from . In words, an Nbridge is an Nwalk of even length whose minimum is not strictly positive, nor is its maximum strictly negative^{2}^{2}2We thank Mireille BousquetMélou for suggesting us this approach..
The change in the  (minimal reachable point) and coordinate (maximal reachable point) can be conveniently encoded in the minmaxchange polynomial
Then, the construction can be interpreted as the one of twodimensional 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 Nwalks
The step set of classical Motzkin paths is . The Nstep set of all nonempty subsets is
and we call the corresponding Nwalks Motzkin Nwalks. A Motzkin Nwalk 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 Nwalks.
A Motzkin Nwalk is of type if and only if it is constructed only from the Nsteps , , , and . Otherwise, it is of type .
The proof is based on a recurrence and a casebycase analysis on the number and type of Nsteps.
The set of Motzkin Nwalks of type (resp. ) is denoted by (resp. ), and their generating functions are defined as
The generating functions of Motzkin Nwalks of type and are rational. The generating function of Motzkin Nbridges is algebraic.
The first statement is a direct corollary of the previous proposition due to a simple sequence construction. An Nbridge of type is an Nwalk that satisfies , , and is even. Note that in this case this property is not equivalent to an even number of steps. An Nbridge of type is an Nwalk that satisfies and . Thus, the generating function of Motzkin Nbridges is equal to
Since the generating functions of and are rational, according to [4, Proposition 1] (see also [13]), the generating function of Nbridges is Dfinite. 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 closedform 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 Nbridges among all Nwalks. For example, when all weights are set to , it is equal to
Hence, nearly all Nwalks are Nbridges.
We now turn to the analysis of Motzkin Nmeanders and Nexcursions.
The generating functions of Motzkin Nmeanders and Nexcursions are algebraic.
Without loss of generality we perform all computations here with all weights . Let and denote the Motzkin Nmeanders of type and . Their generating functions are
Let also
denote the column vector
. An Nmeander is either empty – in which case, it is of type – or it is an Nmeander followed by an Nstep . The type of depends on the type of , the Nstep , 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 twobytwo matrices with Laurent polynomials in and given in Figure 3. Observe that the first two matrices are uppertriangular.
This equation is rearranged into
(2)  
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 Nmeanders. 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 lefthand side of Equation (2) vanishes both when evaluated at and leftmultiplied by , and also when evaluated at and leftmultiplied by . Combining the corresponding two righthand sides, we obtain a new twobytwo system of linear equations
(3) 
where the vector of size has its first element equal to , and its second element equal to
and the twobytwo matrices and are two large to be shown here. Again, the matrix is uppertriangular. We now define
and the row vectors
to ensure that and have series expansions at the origin, and that the lefthand side of Equation (3) vanishes both when evaluated at and leftmultiplied by , and also when evaluated at and leftmultiplied by . The corresponding two righthand side are combined to form a new twobytwo 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 Nmeanders with maximum reachable point is equal to
This expression is injected in Equation (3) to express the generating function of Motzkin Nmeanders with minimum reachable point
Finally, this expression is injected in Equation (2) to express the generating function of Motzkin Nmeanders
The generating function of Nmeanders and Nexcursions 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 Nmeanders is algebraic of degree and given by
The total number of Nmeanders is asymptotically equal to
The generating function of Nexcursions is algebraic of degree . Their asymptotic number is
Comments
There are no comments yet.