The height and width of bargraphs

The height and width of bargraphs

Discrete Applied Mathematics 180 (2015) 36–44 Contents lists available at ScienceDirect Discrete Applied Mathematics journal homepage: www.elsevier...

413KB Sizes 2 Downloads 59 Views

Discrete Applied Mathematics 180 (2015) 36–44

Contents lists available at ScienceDirect

Discrete Applied Mathematics journal homepage: www.elsevier.com/locate/dam

The height and width of bargraphs Aubrey Blecher a , Charlotte Brennan a , Arnold Knopfmacher a,∗ , Helmut Prodinger b a

The John Knopfmacher Centre for Applicable Analysis and Number Theory, University of the Witwatersrand, P.O. Wits 2050, South Africa b

Department of Mathematics, University of Stellenbosch, 7602, Stellenbosch, South Africa

article

abstract

info

A bargraph is a lattice path in N20 with three allowed steps: the up step u = (0, 1), the down step d = (0, −1) and the horizontal step h = (1, 0). It starts at the origin with an up step and terminates as soon as it intersects the x-axis again. A down step cannot follow an up step and vice versa. The height of a bargraph is the maximum y coordinate attained by the graph. The width is the horizontal distance from the origin till the end. For bargraphs of fixed semi-perimeter n we find the generating functions for the total height and the total width and hence find asymptotic estimates for the average height and the average width. Our methodology makes use of a bijection between bargraphs and uudd-avoiding Dyck paths. © 2014 Elsevier B.V. All rights reserved.

Article history: Received 20 January 2014 Received in revised form 13 August 2014 Accepted 20 August 2014 Available online 12 September 2014 Keywords: Bargraphs Generating functions Height Asymptotics

1. Introduction A bargraph is a lattice path in N20 , analogous to Dyck or Motzkin paths. There are three allowed steps: the up step (0, 1), the down step (0, −1) and the horizontal step (1, 0) denoted by u, d and h respectively. The bargraph starts at the origin with an up step and terminates as soon as the path intersects the x-axis again. A down step cannot follow an up step and vice versa. The height of a bar graph is the maximum y coordinate attained by the graph, the width is the maximum x coordinate and the semi-perimeter is the sum of the number up and horizontal steps. So for example, we have the bargraph (see Fig. 1). Bargraphs have been studied particularly in statistical physics; see [4–6,9–14]. Other names used for bargraphs are wall polyominoes [7] or skylines [9]. In [1–3], the first three authors investigate various combinatorial statistics associated with bargraphs. In this paper, we find the generating function for bargraphs of height at most h and use this to find an asymptotic expression for the average height of bargraphs of semi-perimeter n. We also consider the width or horizontal semi-perimeter of bargraphs with fixed total semi-perimeter. A main tool for studying statistics of interest is a decomposition of bargraphs which is based on the first return to level one; see [13]. This was also used by Bousquet-Mélou and Rechnitzer in [5], where they called it the wasp-waist decomposition. The current authors have also made extensive use of it in [1–3]. The generating function for all bargraphs can be found in [5] amongst others. It is given by B(x, y) =

1 − x − y − xy −

 (1 − x − y − xy)2 − 4x2 y 2x



Corresponding author. Tel.: +27 117176241; fax: +27 865535618. E-mail addresses: [email protected] (A. Blecher), [email protected] (C. Brennan), [email protected] (A. Knopfmacher), [email protected] (H. Prodinger). http://dx.doi.org/10.1016/j.dam.2014.08.026 0166-218X/© 2014 Elsevier B.V. All rights reserved.

(1.1)

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

37

Fig. 1. A bargraph of height 6, width 13 and semi-perimeter 25.

Fig. 2. Wasp-waist factorisation of bargraphs.

where x counts the number of horizontal steps and y counts the number of up steps. If we substitute z = y = x we obtain the generating function for the semi-perimeter counted by z, often called the isotropic generating function B(z , z ) =

1 − 2z − z 2 −



1 − 4z + 2z 2 + z 4

. (1.2) 2z To find the asymptotics for B(z , z ), we must first compute the dominant singularity ρ which is the positive root of D := 1 − 4z + 2z 2 + z 4 = 0. We find ρ=

1

4 × 22/3



3

−1 −

√ (13 + 3 33)1/3

√ 1/3  + 2(13 + 3 33)



= 0.295598 . . . .

(1.3)

Then B(z , z ) ∼ ψ1 (z )(1 − z /ρ)1/2 and by singularity analysis (see [8]) we have

[z n ]B(z , z ) ∼

ψ1 (ρ)ρ −n √ 2 π n3

(1.4)

where

 ψ1 (ρ) =

1 − ρ − ρ3

ρ

.

2. The generating function for bargraphs of height at most h For a fixed h ≥ 1, let G(x, y, h) be the generating function for bargraphs in which x marks the total number of horizontal steps, y marks the total number of ascent steps and for which the height of the graph is less or equal to h. For simplicity we will write Gh := G(x, y, h). Following Bousquet-Mélou and Rechnitzer in [5], and the authors own use in [1–3] and in [13], the ‘‘wasp-waist’’ decomposition for Gh is represented symbolically in Fig. 2. Restricting all heights to at most h, the decomposition yields Gh = xy + xGh + yGh−1 + xyGh−1 + xGh−1 Gh .

 1

 2

   3

   4

   5

Solving this for Gh , we obtain the continued fraction type recursion Gh =

xy + (1 + x)yGh−1 1 − x − xGh−1

.

(2.1) p(h)

In order to solve this recursion, we write the rational function Gh as q(h) , and so obtain from (2.1) p(h) q(h)

=

xyq(h − 1) + (1 + x)yp(h − 1)

(1 − x)q(h − 1) − xp(h − 1)

.

(2.2)

38

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

Equating the numerator and the denominator we obtain the simultaneous equations



p(h) = xyq(h − 1) + (1 + x)yp(h − 1), q(h) = (1 − x)q(h − 1) − xp(h − 1),

(2.3)

or in the matrix form



p(h) q(h)



 =

(1 + x)y −x



xy 1−x

p(h − 1) . q(h − 1)



(2.4)

Let A be the matrix A=

 (1 + x)y −x



xy 1−x

whose eigenvalues λ1 and λ2 are obtained from the characteristic equation

λ2 − λ(1 − x + y + xy) + y = 0. These are

λ1 :=

1 − x + y + xy +

λ2 :=

1 − x + y + xy −

 −4y + (1 − x + y + xy)2 2

and

 −4y + (1 − x + y + xy)2 2

with corresponding eigenvectors



1−x+

1 2



   −1 + x − y − xy ∓ −4x + (1 − x + y + xy)2 . x

(2.5)

1 Let D be the diagonal matrix made up of the eigenvalues: D=

 λ2

0



λ1

0

and let T be the matrix whose columns are the corresponding eigenvectors; thus 

1−x+

1 2

   −1 + x − y − xy + −4x + (1 − x + y + xy)2



T = 

1−x+

x

1 2

   −1 + x − y − xy − −4x + (1 − x + y + xy)2  . x 

1

1

Now, if we iterate (2.4) h − 1 times we obtain



p(h) q(h)



= Ah−1



p(1) . q(1)



To get the initial condition, we consider graphs where the height is at most one. The generating function for these graphs is xy . So, clearly the initial matrix is 1−x



p(1) q(1)



 =

xy



1−x

.

In order to work out Ah−1 we use an application of diagonalisation: Ah−1 = T Dh−1 T −1 . The inverse of T is

 T −1 = 

1  −4y + (1 − x + y + xy)2  −1 x

1 − x + 21 (−1 + x − y − xy −



−4x + (1 − x + y + xy)2 )



 −x .  2 1 − x + (−1 + x − y − xy + −4x + (1 − x + y + xy) ) 1 2

x

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

Thus, after multiplying out T Dh−1 T −1 , we obtain Ah−1



p(h) =

xy λh1 − λh2

p(1) q(1)





39

and obtain p(h) and q(h) to be:



λ1 − λ2

and



q(h) =

x2 y(λh2−1 − λh1−1 ) + (1 − x) (λ1 − y − xy)λh1−1 − (λ2 − y − xy)λh2−1



λ1 − λ2

.

p(h)

Finally, from Gh = q(h) we obtain the following theorem. Theorem 1. The generating function for bargraphs of height at most h is Gh =

xy(λh1 − λh2 ) .  x2 y(λ2h−1 − λh1−1 ) + (1 − x) (λ1 − y − xy)λh1−1 − (λ2 − y − xy)λ2h−1

(2.6)

ˆ h (z ) = Gh (z , z ) where z In the isotropic case, we replace x and y by z and obtain the generating function denoted by G measures the semi-perimeter for bargraphs. Thus if λˆ 1 :=

1 + z2 +

 −4z + (1 + z 2 )2 2

and

λˆ 2 :=

1 + z2 −

 −4z + (1 + z 2 )2 2

then we have the following corollary. Corollary 1.

ˆ h (z ) = z 2 G

λˆ h − λˆ h2  1 . ˆ 2h−1 − λˆ h1−1 ) + (1 − z ) (λˆ 1 − z − z 2 )λˆ 1h−1 − (λ2 − z − z 2 )λˆ h2−1 z 3 (λ

ˆ h (z ) for h = 1–7. Below, we show a table that lists the generating functions G h

ˆ h (z ) G

1

z2 1 −z

2

z 2 +z 4 1−2z +z 2 −z 3

3

z 2 (1−z +2z 2 +z 4 ) 1−3z +3z 2 −3z 3 +z 4 −z 5

4

z 2 (1−2z +3z 2 −2z 3 +3z 4 +z 6 ) 1−4z +6z 2 −7z 3 +5z 4 −4z 5 +z 6 −z 7

5

z 2 (1−3z +5z 2 −6z 3 +6z 4 −3z 5 +4z 6 +z 8 ) 1−5z +10z 2 −14z 3 +14z 4 −12z 5 +7z 6 −5z 7 +z 8 −z 9

6

z 2 (1−4z +8z 2 −12z 3 +13z 4 −12z 5 +10z 6 −4z 7 +5z 8 +z 10 ) 1−6z +15z 2 −25z 3 +31z 4 −31z 5 +25z 6 −18z 7 +9z 8 −6z 9 +z 10 −z 11

7

z 2 (1−5z +12z 2 −21z 3 +27z 4 −30z 5 +26z 6 −20z 7 +15z 8 −5z 9 +6z 10 +z 12 ) 1−7z +21z 2 −41z 3 +60z 4 −70z 5 +68z 6 −56z 7 +39z 8 −25z 9 +11z 10 −7z 11 +z 12 −z 13

3. Bijection between bargraphs and uudd-avoiding Dyck paths For any uudd-avoiding Dyck path (where an up step (1, 1) is denoted by u and a down step (1, −1) is denoted by d), excluding the graph ud or the empty path, we define a mapping into bargraphs as follows: prior to the first d in the sequence (i.e., after the initial sequence of u’s) place a vertical bar. Because the Dyck paths avoid uudd (and is not constituted by ud

40

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

Fig. 3. Dyck path mapped to bargraph.

Fig. 4. First return decomposition for Dyck paths avoiding uudd.

only) the d begins a sequence of (du), i.e., (du)(du) · · · (du) with at least one (du). Now place another vertical bar at the end of this sequence. After this, (i.e., to the right) place vertical bars before and after each sequence of at least one (du). What is obtained from this procedure is the Dyck path split into groups by vertical bars. Each group is of the form u · · · u or d · · · d or (du) · · · (du). Now, map the Dyck path to the bargraph as follows (see Fig. 3). Preserving the given order of the group between the bars, map u · · · u to the same u · · · u and ditto for d · · · d. Map each (du) · · · (du) to horizontal steps with the same number of steps as (du)’s. For example, the Dyck path in Fig. 3 is mapped to the bargraph on its right. For the reverse map (from bargraphs into uudd-avoiding Dyck paths), we map every sequence of up steps (or down steps) in the bargraph to corresponding up steps (or down steps) in the Dyck path. We map every sequence of one or more horizontal steps in the bargraph to the same sequence of (du) pairs in the Dyck path. We preserve the order of this mapping from left to right. 4. Dyck paths avoiding uudd In this section, we consider Dyck paths that avoid the pattern uudd. In the previous section we showed a bijection between these Dyck paths (excluding the path ud and the empty path) and bargraphs, which preserves the height. We can represent these restricted Dyck paths using the first return decomposition shown symbolically in Fig. 4, where ε denotes the empty path. Let f (z ) be the generating function that counts Dyck paths avoiding uudd. We label the up step with z. It is clear that in order to have paths that avoid uudd, we cannot allow the paths represented by the first symbolic rectangle after the initial up step in Fig. 4 to contain the path ud. Thus, we have the equation f (z ) = 1 + z (f (z ) − z )f (z ). This quadratic equation has the solution f (z ) =

1 + z2 −



(1 − z )(1 − 3z − z 2 − z 3 ) 2z

.

(4.1)

This confirms that f (z ) = B(z , z ) + 1 + z, as also follows from our bijection. We now restrict the height of these Dyck paths and so use fh (z ) to denote the generating function of such Dyck paths ˆ h (z ) + 1 + z; however we give a direct avoiding uudd with a height ≤ h. Our bijection of Section 3 implies that also fh (z ) = G derivation below which produces a nicer expression for fh (z ). We can use the first return decomposition again, but since the total height is bounded by h, the height of the paths after the initial up step has to be bounded by h − 1. The equation for these bounded paths where h ≥ 2 is therefore fh (z ) = 1 + z (fh−1 (z ) − z )fh (z ). 1 As indicated above, the initial conditions are clearly f0 (z ) = 1 for the empty path and f1 (z ) = 1− for the zigzag path z with maximum height 1 (a sequence of ud steps).

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

41

Making fh (z ) the subject of the formula, we obtain this recursion for h ≥ 2 fh ( z ) =

1 1 − z (fh−1 (z ) − z )

.

(4.2)

4.1. Solving the recursion In order to solve the recursion (4.2), we write it in the form fh ( z ) =

1 1 + z 2 − zfh−1 (z )

=

qh−1 qh

.

We multiply out and iterate once to get the second order recursion

(1 + z 2 )qh−1 − zqh−2 = qh . This recurrence defines a sequence of Chebyshev orthogonal polynomials which is a characteristic feature of height restricted lattice paths (see [8, Chapter 5]). Using standard techniques to solve a second order recursion, we use the characteristic equation

λ2 − (1 + z 2 )λ + z = 0 where the roots are

λ1 =

1 + z2 +



(1 − z )(1 − 3z − z 2 − z 3 ) 2

and

λ2 =

1 + z2 −



(1 − z )(1 − 3z − z 2 − z 3 ) 2

.

1 ; thus q0 = 1 and q1 = 1 − z and when h = 0, f0 (z ) = 1. When h = 1, we have f1 (z ) = 1− z  To simplify the notation, let W := (1 − z )(1 − 3z − z 2 − z 3 ). The solution of the recursion is

qh = Aλh1 − Bλh2 where A :=

1 2

+

1 − 2z − z 2

and B := −

2W

1 2

+

1 − 2z − z 2 2W

.

(4.3)

Thus fh ( z ) =

Aλh1−1 − Bλh2−1 Aλh1 − Bλh2

.

(4.4)

Note that f (z ) = λ1 . 1 5. The generating function for the sum of heights in bargraphs The preceding section shows that the generating function for the sum of heights in bargraphs is equivalent to finding the generating function for the sum of heights of uudd-avoiding Dyck paths. For h ≥ 1, using (4.1) and (4.4) we have f (z ) − fh (z ) =

=

1 + z2 − W 2z 1

λ1





Aλh1−1 − Bλh2−1 Aλh1 − Bλh2

λh1−1 (A − B(λ2 /λ1 )h−1 ) λh1 (A − B(λ2 /λ1 )h )

(A − B(λ2 /λ1 )h−1 ) − λ1 λ1 (A − B(λ2 /λ1 )h )   1 (A − B(λ2 /λ1 )h−1 ) 1− = λ1 (A − B(λ2 /λ1 )h ) 1 (A − B(λ2 /λ1 )h ) − (A − B(λ2 /λ1 )h−1 ) = λ1 (A − B(λ2 /λ1 )h ) =

1

42

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

1 −B(λ2 /λ1 )h + B(λ2 /λ1 )h−1

=

λ1

(A − B(λ2 /λ1 )h ) 1 B(λ2 /λ1 )h−1 (1 − λ2 /λ1 ) = λ1 (A − B(λ2 /λ1 )h ) W B(λ2 /λ1 )h−1 = 2 λ1 (A − B(λ2 /λ1 )h ) B(λ2 /λ1 )h

W

=

λ1 λ2 (A − B(λ2 /λ1 )h ) B A

W

=

(λ2 /λ1 )h

z 1 − AB (λ2 /λ1 )h

.

(5.1)

If h = 0 we have f (z )− f0 (z ) = f (z )− 1 = λ1 − 1. Now the generating function for the sum of heights in all uudd-avoiding 1 Dyck paths is given by ∞  

1

f (z ) − fh (z ) =



λ1

h=0

−1+

B A

∞  W h=1

(λ2 /λ1 )h

z 1 − AB (λ2 /λ1 )h

= z + z 2 + 3z 3 + 10z 4 + 32z 5 + 101z 6 + 318z 7 + 1003z 8 + 3173z 9 + 10071z 10 + · · · . 6. Asymptotics for the total height of bargraphs To find asymptotics of

B

W A (λ2 /λ1 ) h≥1 z 1− B (λ /λ )h A 2 1



we have

h

λ

from (5.1), we need an asymptotic expression for λ2 . With ρ defined in (1.3) 1

√   λ2 1 − C 1 − z /ρ ∼ 1 − 2C 1 − z /ρ ∼ exp(−2C 1 − z /ρ), ∼ √ λ1 1 + C 1 − z /ρ

where C = Since

B A

2



1 + ρ2

ρ(1 − ρ − ρ 3 ).

∼ 1, we need to study (λ2 /λ1 )h . 1 − (λ2 /λ1 )h

W  z

h≥1

W z

Ignoring the

factor for the moment, we need to find an asymptotic expression for





exp(−2Ch 1 − z /ρ)

h≥1

1 − exp(−2Ch 1 − z /ρ)



which corresponds to



exp(−ht )

1 − exp(−ht ) h≥1 with t = 2C

1 − z /ρ.



This series in t can be studied with the Mellin transform as t → 0. Thereafter we have the expansion in 1 − z /ρ , and then we use singularity analysis [8]. We first apply the Mellin transform and get

M

 h ≥1

e−ht 1−

e−ht



=



h−s M

h ≥1

 e −t  = Γ (s)ζ 2 (s). 1 − e −t

We then apply the inverse Mellin transform and use the residues at s = 0 and s = 1 to get W  z

h≥1

e−ht 1−

e−ht



W  γ − ln t z

t

+

1 4

.

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

Substituting t = 2C ∞  



1 − z /ρ and W ∼ C C

f (z ) − fh (z ) ∼





z

43

1 − ρz we get

1 − ρz  γ − ln(2C √1 − z /ρ )

h=0





2C



1 − z /ρ

+

1



4



 γ C 1 − z /ρ 1 − ln(2C 1 − z /ρ ) + . 2ρ 2ρ 4ρ

We shall consider the dominant term only which, in this case, is the log term



1

ln(2C





1 − z /ρ ) = −

1  1  z  ln 2 + ln C + ln 1 − . 2ρ 2 ρ

Thus, for the asymptotic growth of the coefficient of z n , we consider



−[z n ]

ln 1 − ρz

 =



1 4nρ n+1

.

Finally, we need to divide by the total number of bargraphs which by (1.4) is asymptotic to n−3/2 ρ −n



4 πρ

C (1 + ρ 2 ).

Thus, we obtain the following theorem. Theorem 2. The mean height of bargraphs of semi-perimeter n and also the mean height of uudd-avoiding Dyck paths of semilength n are asymptotic to





C (1 + ρ 2 )

=

1 2



√ nπ ≈ 1.97877 n. ρ(1 − ρ − ρ 3 )

7. The width of bargraphs In this final section, we consider the width of bargraphs with fixed perimeter n. The width is equivalent to the horizontal semi-perimeter. Here, we shall use the generating function (1.1) for all bargraphs B(x, y) =

1 − x − y − xy −



(1 − x − y − xy)2 − 4x2 y

(7.1) 2x where x counts the number of horizontal steps and y counts the number of up steps. We introduce the new generating function where now y marks the total semi-perimeter and x marks the width as B(xy, y). The derivative of B(xy, y) with respect to x with the substitution x = 1 is

  (1 − y)(1 − 2y − y2 − 1 − 4y + 2y2 + y4 ) ∂ B(xy, y)   = ∂ x  x =1 2y 1 − 4y + 2y2 + y4

(7.2)

with a series expansion that starts with y2 + 3y3 + 10y4 + 33y5 + 108y6 + 353y7 + 1154y8 + 3776y9 + 12371y10 + 40586y11 + 133337y12 . This is the generating function for the sum of widths of all bargraphs of semi-perimeter n. 7.1. Asymptotics for the total width Using singularity analysis [8], the coefficient of yn in (7.2) is

 (1 − ρ)(1 − 2ρ − ρ 2 ) ∂ B(xy, y)   ∼ [y ]  ∂x 4ρ n+1 π n ρ(1 − ρ − ρ 3 ) x =1 where ρ is given in (1.3). n

(7.3)

Thus to obtain the average, we divide (7.3) by the coefficient of yn in B(y, y) given in (1.4). This can be expressed in the following theorem. Theorem 3. The average width of bargraphs with semi-perimeter n is asymptotic to

(1 − ρ)(1 − 2ρ − ρ 2 ) n ≈ 0.564384n. ρ 2 (1 − ρ − ρ 3 )

44

A. Blecher et al. / Discrete Applied Mathematics 180 (2015) 36–44

References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

A. Blecher, C. Brennan, A. Knopfmacher, Combinatorial parameters in bargraphs (in preparation). A. Blecher, C. Brennan, A. Knopfmacher, Levels in bargraphs (submitted for publication). A. Blecher, C. Brennan, A. Knopfmacher, Peaks in bargraphs, Manuscript. M. Bousquet-Mélou, R. Brak, Exactly solved models of polyominoes and polygons, in: Polygons, Polyomiones and Polycubes, in: Lecture Notes in Physics, vol. 775, Springer, Berlin, Heidelberg, 2009, pp. 43–78. Chapter 3 of. M. Bousquet-Mélou, A. Rechnitzer, The site perimeter of bargraphs, Adv. Appl. Math. 31 (2003) 86–112. P. Duchon, q-grammars and wall polyominoes, Ann. Comb. 3 (1999) 311–321. S. Feretić, A perimeter enumeration of column-convex polyominoes, Discrete Math. Theoret. Comput. Sci. 9 (2007) 57–84. P. Flajolet, R. Sedgewick, Analytic Combinatorics, Cambridge University Press, 2009. A. Geraschenko, An investigation of skyline polyominoes. http://people.brandeis.edu/~gessel/47a/geraschenko.pdf. E.J. Janse van Rensburg, P. Rechnitzer, Exchange symmetries in Motzkin path and bargraph models of copolymer adsorption, Electron. J. Combin. 9 (2002) R20. J. Osborn, T. Prellberg, Forcing adsorption of a tethered polymer by pulling, J. Stat. Mech. Theory Exp. (2010) P09018. A. Owczarek, T. Prellberg, Exact solution of the discrete (1 + 1)-dimensional SOS model with field and surface interactions, J. Stat. Phys. 70 (5–6) (1993) 1175–1194. T. Prellberg, R. Brak, Critical exponents from nonlinear functional equations for partially directed cluster models, J. Stat. Phys. 78 (1995) 701–730. C. Richard, I. Jensen, A.J. Guttmann, Scaling function for self-avoiding polygons, in: Proceedings TH2002 Supplement, Birkhäuser Verlag, Basel, 2003, pp. 267–277.