Abstract
We study the distributional properties of horizontal visibility graphs associated with random restrictive growth sequences and random set partitions of size n. Our main results are formulas expressing the expected degree of graph nodes in terms of simple explicit functions of a finite collection of Stirling and Bernoulli numbers.
Keywords: restricted growth function, partitions of a set, horizontal visibility graph
1. Introduction and statement of results
We study here horizontal visibility graphs of restricted growth sequences. The latter class of sequences is of interest both independently and in connection with set partitions [19], q-analogues [2], certain combinatorial matrices [7], bargraphs [20], and Gray codes [5].
A horizontal visibility graph (HVG) [17] constitutes a paradigmatic complex network representation of sequential data, typically used to reveal order structures within the data set [8, 35]. HVG-based algorithms have been employed to characterize fractal behavior of dynamical systems [21, 31], study canonical routes to chaos (see [24] and references therein), discriminate between chaotic and stochastic time series [26], and test time series irreversibility [33]. There is a growing body of literature using these combinatorial data analysis techniques in applied fields such as optics [1], fluid dynamics [22], geophysics [30], physiology and neuroscience [18, 27], finance [25], image processing [13], and more [8, 35]. For other graph theoretic methods of applied time series analysis as well as many fruitful extensions of the horizontal visibility algorithm, we refer to recent surveys [8, 35].
From a combinatoric point of view, HVGs are outerplanar graphs with a Hamiltonian path, an important subclass of so-called non-crossing graphs of algebraic combinatorics [10]. An illuminating characterization of HVGs using “one-point compactified” times series and tools of algebraic topology is obtained in a recent work [29]. Theoretical body of work on the HVGs includes studies of their degree distributions [14, 16], information-theoretic [9, 15] and other [11] topological characteristics, motifs [12, 32], spectral properties [6, 17], and dependence of graph features on the parameter for a specific parametric family of chaotic [4] or stochastic processes [31, 34]. For more, see a recent comprehensive survey [35] and an extensive review of earlier results [23].
In this paper, our main focus is on the degree properties of the horizontal visibility graph associated with a random restricted growth sequence. Let π = π1 ⋯ πn be a sequence of elements of a totally ordered set. We say that (πi, πj) is a strong visible pair if
where we use the usual convention that max ∅ = −∞. Similarly, we refer to (πi, πj) as a weak visible pair if
We denote by the set of all strong visible pairs of π, and let be the number of strong visible pairs in the sequence π. For example,
We use the above notation with addition of the superscript w to denote the corresponding weak visibility pairs statistics. For example,
The graph with the set of nodes [n] := {1, 2, … , n}is the horizontal visibility graph associated with π [17]. For i ∈ [n], we denote by dπ(i) the degree of the node i in the visibility graph . We set eπ(i, j) = 1 when and eπ(i, j) = 0 otherwise. Thus,
| (1) |
We now turn to the definition of a restricted growth sequence. A sequence of positive integers is called a restricted growth sequence if
There is a bijective connection between these sequences and canonical set partitions. A partition of a set A is a collection of non-empty, mutually disjoint subsets, called blocks, whose union is the set A. A partition II with k blocks is called a k-partition and denoted by II = A1|A2|⋯|Ak. A k-partition A1|A2|⋯|Ak is said to be in the standard form if the blocks Ai are labeled in such a way that
The partition can be represented equivalently by the canonical sequential form π1π2 … πn, where πi ∈ [n] and for all i [19]. In words, πi is the label of the partition block that contains i. It is easy to verify that a word π ∈ [k]n is a canonical representation of a k-partition of [n] in the standard form if and only if it is a restricted growth sequence [19].
Example 1.1.
For instance, canonical partition {1, 4, 7} | {2, 3, 6, 9} | {5, 8} in the canonical sequential form is π = 122132132, where π3 = 2 indicates that 3 belongs to the second block {2, 3, 6, 9}, etc. The (weak and strong) visibility graphs of π are given in Fig. 1 below.
Figure 1:

On he left is a picture of the strong visibility graph of the sequence 12132132231. On the right, is the weak visibility graph associated with same sequence.
We denote by the set of all restricted growth sequences of length n. For a given , we let , the number of different letters in the word π. For example, . We denote by the set of all restricted growth sequences π with . Clearly, .
It is well-known that and where Sn,k is a Stirling number of second kind and Bn is the n-th Bell number [19]. The Stirling numbers can be introduced algebraically in several different ways. For instance,
| (2) |
Alternatively, one can define the sequence of Stirling numbers of the second kind as the solution to the recursion
| (3) |
with S0,0 = 1 and S0,n = 0. The sequence of Bell numbers (Bn)n≥0 can be then defined for instance, through the formula , or, recursively via the formula with B0 = 1, or through Dobinski’s formula [3]
| (4) |
In what follows, we denote a random restricted growth sequence, sampled uniformly from by π(n) (resp. π(n,k)). That is,
and
We denote by the HVG of the random restrictive growth sequence π(n,k) (resp. π(n)). Furthermore, we use the notations en(., .), dn(.), and Vn to denote, respectively, , , and . See Fig. 2 below for two instances of visibility graphs of uniformly sampled restrictive growth sequences of length n = 200.
Figure 2:

An instance of (on the left) and the corresponding (on the right).
For any , we define the generating function
| (5) |
Knowing an explicit form of (5), would in principle give us the distribution of Vn in full details for all . Unfortunately, so far we were unable to find an explicit form of Pk(x, q). In this paper, we calculate instead the following generating function:
Theorem 1.2.
We have:
where
and is the exponential integral.
Example 1.3.
First several terms of the generating function Q(x, 1) are given by
The proof of Theorem 1.2 is given in Section 2. The solution is derived from a PDE for T which is obtained in Lemma 2.6. Our next result, Theorem 1.4, gives a an alternative, closed form expression for E(Vn) through a different, probabilistic approach.
We partition In = {(i, j) : 1 ≤ i < j ≤ n} into three subsets
Clearly, eπ (i, j) = 0 on and eπ (i, j) = 1 on for all . Therefore,
| (6) |
The following theorem evaluates the probability that for a given in terms of explicit multi-linear polynomials of Sk,i, Bi, and Bernoulli numbers. By virtue of (1), the result immediately yields the average degree E(dn(i)) of any given node i ∈ Vn and the average number of edges E(Vn).
We will use the following Bernoulli formula for Faulhaber polynomials [3]:
| (7) |
where are Bernoulli numbers. The latter can be calculated, for example, using the recursion
with . See, for instance, [3] for alternative definitions of Bernoulli numbers.
We will also need the following well-known extension of Dobinski’s identity (4). For any integers n, t ≥ 0 we have:
| (8) |
were in the last step we applied the original formula (4).
Theorem 1.4.
For all n ≥ 3 and , we have
The proof of Theorem 1.4 is deferred to Section 3. We next evaluate the probability that for a given pair of nodes i, j ∈ [n], we have but .
Theorem 1.5.
The following holds true for n ≥ 3:
- If , then
- If , then
Since , we have
which yields . The proof of Theorem 1.5 is included in Section 4.
2. Proof of Theorem 1.2
Throughout this section, for any given ordinary generating function , , we use A to denote the corresponding exponential generating function. That is,
where [xn]A(x) stands for the coefficient of xn in the generating function A(x).
Note that each restricted growth sequence in can be represented as a word in the form 1π(1)2π(2) ⋯ kπ(k), where π(j) is an arbitrary subword over the alphabet [j]. Therefore, we can rewrite (5) as
| (9) |
where Lk(x, q) and Mk(x, q) are given by
| (10) |
This representation is instrumental in our proof of the following result:
Proposition 2.1.
For k ≥ 1,
where is defined recursively by the equation
with the initial condition .
Proof of Proposition 2.1.
In view of (9) and (10), in order to prove the proposition it suffices to evaluate Lk(x, q) and Mk(x, q). These calculations are the content of the next two lemmas.
Lemma 2.2.
For all k ≥ 1,
where satisfies the recurrence relation
with .
Proof of Lemma 2.2.
Any word kπ ∈ [k]n can be written as
for some s ≥ 1 and subwords π(j) ∈ [k − 1]. Thus, the contribution for a fixed s is , where
Hence,
| (11) |
Note that any word π ∈ [k − 1]n can be written as π(0)(k − 1)π(1) ⋯ (k − 1)π(s) with s ≥ 0 and π(j) is a word over alphabet [k − 2] for all j. Thus,
| (12) |
where we used the fact that V (kπ′k) = V ((k − 1)π′ (k − 1)) for all π′ [k − 2]n. Hence, by (11) and (12), we see that , which leads to
By induction on k, and using the fact that , we complete the proof for the formula Lk(x, q).
Now let us write an equation for . Clearly, , which counts the only empty word according the the visible pairs in 11. Note that for any word π ∈ [k − 1]n, the word kπk can be decomposed as kπ(0)(k − 1)π(1) ⋯ (k − 1)π(s)k with π(j) is a word over alphabet [k − 2] for all j. Thus,
where we used that fact V (kπ′(k − 1)) = V ((k − 1)π′(k − 1)) for all π′ ∈ [k − 2]n. □
Lemma 2.3.
For all k ≥ 1,
Proof of Lemma 2.3.
For any word kπ ∈ [k]n, the word kπ(k + 1) can be decomposed as either kπ′(k + 1) or kπ′kπ″(k + 1), where π′ is a word over alphabet [k − 1] and π″ is a word over alphabet [k]. Since V (kπ′(k + 1)) = V (kπ′k), we have
which, by solving for Mk(x, q), complete the proof of Lemma 2.3. □
By Lemmas 2.2 and 2.3 and (9), we have
The proof of Proposition 2.1 is complete. □
Example 2.4.
The first coe cients of the generating function are given by 1 + x + 2qx2 + 5q2x3 + (2q4 + 13q3)x4 + (18q5 + 34q4)x5 + (11q7 + 103q6 + 89q5)x6 + (6q9 + 160q8 + 478q7 + 233q6)x7 + (2q11 + 206q10 + 1359q9 + 1963q8 + 610q7)x8 + (230q12 + 3066q11 + 8813q10 + 7441q9 + 1597q8)x9.
With Proposition 2.1 at hand, we turn now to the study of the expected number of vertexes in . More precisely, we obtain:
Proposition 2.5.
For all k ≥ 1,
where
with
We use here the usual convention that an empty sum is zero.
Proof of Proposition 2.5.
By Proposition 2.1, the generating function satisfies
with . Thus,
with . Hence, by induction on k, we have .
Moreover, by differentiation the recurrence relation at q = 1, we obtain
which, by , implies
We can now complete the proof of the proposition by using induction on k and the initial condition . □
By Proposition 2.5, we have:
with . For all k ≥ 2, define
Then,
| (13) |
with .
In order to solve (13), we first study the corresponding exponential generating functions Qk(x) and Tk(x) of the ordinary generating functions and Tk(x), respectively. In other words,
and
Lemma 2.6.
The generating function is given by
where .
Proof of Lemma 2.6.
By the definition of Tk(x), we have:
with . Rewriting this equation in terms of exponential generating functions, we obtain:
where we used (2) and the fact that .
Multiplying both sides of the last recurrence by yk and summing over k ≥3, we obtain:
where T2(x) = ex − 1 − x. Note that
Solving the partial differential equation with these initial conditions, we obtain the result in Lemma 2.6. □
Finally,
with Q1(x) = 1 + (x − 1)ex.
Recall . Multiplying both sides of this recurrence equation by yk and summing over k ≥ 2, we obtain
with Q(0, y) = 0 and This along with Lemma 2.6 and an aid of Maple, yields the explicit formula for the generating function Q(x, y) stated in Theorem 1.2. □
3. Proof of Theorem 1.4
The proof relies on the use of a generator of a uniformly random set partition of [n] proposed by Stam [28]. We next describe Stam’s algorithm for a given n.
-
For , let . Dobinski’s formula (4) shows that μn(·) is a probability distribution on .
At time zero, choose a random distributed according to μn, and arrange M empty and unlabeled boxes.
-
Arranges n balls labeled by integers from the set [n].
At time i ∈ [n], place the ball ‘i’ into of one the M boxes, chosen uniformly at random. Repeat until there are no balls remaining.
Label the boxes in the order that they get occupied by the balls. Once a box is labeled, the label does not change anymore.
Form a set partition π of [n] with i in the k-th block if and only if ball ‘i” is in the k-th box.
Let Ni be the random number of nonempty boxes right after placing the i-th ball and Xi be the label of the box where the i-th ball was placed. Notice that if the i-th ball is dropped in an empty box, then Xi = Ni−1 + 1 and Ni = Ni−1 + 1. Otherwise, if the box was occupied previously, Xi = Xj where j < i is the first ball that was dropped in that box and Ni = Ni−1. Then, X := X1 ⋯ Xn is the random set partition of [n] produced by the algorithm.
We denote by Pm(·) conditional probability distribution P (· | M = m). Clearly N1 = 1, Ni ≤ i, and
Let αi,t(m) := Pm(Ni = t). Then, taking in account that
we obtain:
A comparison with (3) reveals that for t ≤ m,
| (14) |
In addition,
Notice that some of the boxes may remain empty at the end of the algorithm’s run.
In view of (6), in order to calculate E(Vn), we need to evaluate
for . For any constant we have:
| (15) |
Furthermore, for any a ≤ t ≤ m we have:
Iterating, we obtain:
| (16) |
Denote p := maxi<ℓ<j bℓ and q := |{ℓ ∈ (i, j) : bℓ = p}|. In this terms, the last summation can be written as
where Ψi−j is introduced in (7). Thus,
| (17) |
Inserting (14) and (17) into (15) and taking expectation with respect to μn(·), we obtain:
as desired. □
4. Proof of Theorem 1.5
Write:
Case I) If , then similarly to the calculation in (15), for any we have:
| (18) |
Similarly to (16), for a ≤ t ≤ m we have:
| (19) |
The first term on the right hand-side of (19) can be written as
| (20) |
Similarly, the second term in right hand side of (19) contributes:
| (21) |
Inserting (20) and (21) back into (19), we obtain:
Plugging the result into (18) and taking expectation with respect to μn(·) gives:
The result in case (i) follows from this formula by changing the order of summation and applying (8).
Case (ii) If , then
Hence, an application of Dobinski’s identity (4) yields
as desired. □
Figure 3:

Empirical distributions of V200 (left) and (right) based on 1500 samples.
References
- [1].Aragoneses A, Carpi L, Tarasov N, Churkin DV, Torrent MC, Masoller C, and Turitsyn SK, Unveiling temporal correlations characteristic of a phase transition in the output intensity of a fiber laser, Phys. Rev. Lett 116 (2016), 033902. [DOI] [PubMed] [Google Scholar]
- [2].Cai Y and Readdy MA, q-Stirling numbers: a new view, Adv. in Appl. Math 86 (2017), 50–80. [Google Scholar]
- [3].Comtet L, Advanced Combinatorics. The Art of Finite and Infinite Expansions, revised and enlarged edition, D. Reidel Publishing Co., 1974. [Google Scholar]
- [4].Conejero JA, Lizama C, Mira-Iglesias A, and Rodero C, Visibility graphs of fractional Wu-Baleanu time series, Di erence Equ. Appl 25 (2019), 1321–1331. [Google Scholar]
- [5].Conflitti A and Mamede R, Gray codes and lexicographical combinatorial generation for nonnesting and sparse nonnesting set partitions, Theoret. Comput. Sci 592 (2015), 87–96. [Google Scholar]
- [6].Flanagan R, Lacasa L, and Nicosia V, On the spectral properties of Feigenbaum graphs, 2019, preprint is available at https://arxiv.org/abs/1903.00754.
- [7].Galvin D and Pacurar A, Total non-negativity of some combinatorial matrices, 2019, preprint is available at https://arxiv.org/abs/1807.08658.
- [8].Gao Z-K, Small M, and Kurths J, Complex network analysis of time series, Europhys. Lett. EPL 116 (2016), 50001. [Google Scholar]
- [9].Gonçalves BA, Carpi L, Rosso OA, and Ravetti MG, Time series characterization via horizontal visibility graph and Information Theory, Phys. A 464 (2016), 93–102. [Google Scholar]
- [10].Gutin G, Mansour T, and Severini S, A characterization of horizontal visibility graphs and combinatorics on words, Phys. A 390 (2011), 2421–2428. [Google Scholar]
- [11].Hasson U, Iacovacci J, Davis B, Flanagan R, Tagliazucchi E, Laufs H, and Lacasa L, A combinatorial framework to quantify peak/pit asymmetries in complex dynamics, Sci. Rep 8 (2018), 3557. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [12].Iacovacci J and Lacasa L, Sequential visibility-graph motifs, Phys. Rev. E 93 (2016), 042309. [DOI] [PubMed] [Google Scholar]
- [13].Iacovacci J and Lacasa L, Visibility graphs for image processing, to appear in IEEE Trans. Pattern Anal. Mach. Intell, 2019, https://ieeexplore.ieee.org/document/8606219. [DOI] [PubMed] [Google Scholar]
- [14].Lacasa L, On the degree distribution of horizontal visibility graphs associated to Markov processes and dynamical systems: diagrammatic and variational approaches, Nonlinearity 27 (2014), 2063–2093. [Google Scholar]
- [15].Lacasa L and Just W, Visibility graphs and symbolic dynamics, Phys. D 374/375 (2018), 35–44. [Google Scholar]
- [16].Luque B and Lacasa L, Canonical horizontal visibility graphs are uniquely determined by their degree sequence, Eur. Phys. J. Sp. Top 226 (2017), 383–389. [Google Scholar]
- [17].Luque B, Lacasa L, Ballesteros F, and Luque J, Horizontal visibility graphs: Exact results for random time series, Phys. Rev. E 80 (2009), 046103. [DOI] [PubMed] [Google Scholar]
- [18].Madl T, Network analysis of heart beat intervals using horizontal visibility graphs, In 2016 Computing in Cardiology Conference (CinC), 733–736, IEEE, 2016. [Google Scholar]
- [19].Mansour T, Combinatorics of Set Partitions, CRC Press, 2013. [Google Scholar]
- [20].Mansour T and Shattuck M, Counting water cells in bargraphs of compositions and set partitions, Appl. Anal. Discrete Math 12 (2018), 413–438. [Google Scholar]
- [21].Manshour P, Complex network approach to fractional time series, Chaos 25 (2015), 103105. [DOI] [PubMed] [Google Scholar]
- [22].Manshour P, Rahimi Tabar MR, and Peinche J, Fully developed turbulence in the view of horizontal visibility graphs, J. Stat. Mech. Theory Exp 2015, P08031. [Google Scholar]
- [23].Nuñez AM, Lacasa L, Gomez JP, and Luque B, Visibility algorithms: a short review. In: Zhang Y (Ed.), New Frontiers in Graph Theory, 119–152, InTech, Rijeka, 2012. [Google Scholar]
- [24].Núñez ÁM, Luque B, Lacasa L, Gómez JP, and Robledo A, Horizontal visibility graphs generated by type-II intermittency, J. Phys. A 47 (2014), 035102. [DOI] [PubMed] [Google Scholar]
- [25].Rong L and Shang P, Topological entropy and geometric entropy and their application to the horizontal visibility graph for financial time series, Nonlinear Dyn. 92 (2018), 41–58. [Google Scholar]
- [26].Ravetti MG, Carpi LC, Gon¸alves BA, Frery AC, and Rosso OA, Distinguishing noise from chaos: Objective versus subjective criteria using horizontal visibility graph, PLoS ONE 9 (2014), e108004. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [27].Sannino S, Stramaglia S, Lacasa L, and Marinazzo D, Visibility graphs for fMRI data: Multiplex temporal graphs and their modulations across resting-state networks, Netw. Neurosci 3 (2017), 208–221. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [28].Stam AJ, Generation of random partitions of a set by an urn model, J. Combin. Theory Ser. A 35 (1983), 231–240. [Google Scholar]
- [29].Stephen C, Horizon visibility graphs and time series merge trees are dual, 2019, preprint is available at https://arxiv.org/abs/1906.08825.
- [30].Telesca L and Chelidze T, Visibility graph analysis of seismicity around Enguri High Arch Dam, Caucasus, Bull. Seismol. Soc. Am 108 (2018), 3141–3147. [Google Scholar]
- [31].Xie W-J and Zhou W-X, Horizontal visibility graphs transformed from fractional Brownian motions: Topological properties versus the Hurst index, Phys. A 390 (2011), 3592. [Google Scholar]
- [32].Xie W-J, Han R-Q, and Zhou W-X, Tetradic motif profiles of horizontal visibility graphs, Commun. Nonlinear Sci. Numer. Simul 72 (2019), 544–551. [Google Scholar]
- [33].Zhang Y, Shang P, Xiong H, and Xia J, Multiscale analysis of time irreversibility based on phase-space reconstruction and horizontal visibility graph approach, Fluct. Noise Lett 17 (2018), 1850006. [Google Scholar]
- [34].Zou H-L, Yu Z-G, Anh V, and Ma YL, From standard alpha-stable Lévy motions to horizontal visibility networks: dependence of multifractal and Laplacian spectrum, J. Stat. Mech. Theory Exp 2018, 053403. [Google Scholar]
- [35].Zou Y, Donner RV, Marwan N, Donges JF, and Kurths J, Complex network approaches to nonlinear time series analysis, Phys. Rep 787 (2019), 1–97. [Google Scholar]
