Canonical Horizontal Visibility Graphs are uniquely determined by their degree sequence

Horizontal visibility graphs (HVGs) are graphs constructed in correspondence with number sequences that have been introduced and explored recently in the context of graph-theoretical time series analysis. In most of the cases simple measures based on the degree sequence (or functionals of these such as entropies over degree and joint degree distributions) appear to be highly informative features for automatic classification and provide nontrivial information on the associated dynam- ical process, working even better than more sophisticated topological metrics. It is thus an open question why these seemingly simple measures capture so much information. Here we prove that, under suitable conditions, there exist a bijection between the adjacency matrix of an HVG and its degree sequence, and we give an explicit construction of such bijection. As a consequence, under these conditions HVGs are unigraphs and the degree sequence fully encapsulates all the information of these graphs, thereby giving a plausible reason for its apparently unreasonable effectiveness.

Horizontal visibility graphs (HVGs) are graphs constructed in correspondence with number sequences that have been introduced and explored recently in the context of graph-theoretical time series analysis. In most of the cases simple measures based on the degree sequence (or functionals of these such as entropies over degree and joint degree distributions) appear to be highly informative features for automatic classification and provide nontrivial information on the associated dynamical process, working even better than more sophisticated topological metrics. It is thus an open question why these seemingly simple measures capture so much information. Here we prove that, under suitable conditions, there exist a bijection between the adjacency matrix of an HVG and its degree sequence, and we give an explicit construction of such bijection. As a consequence, under these conditions HVGs are unigraphs and the degree sequence fully encapsulates all the information of these graphs, thereby giving a plausible reason for its apparently unreasonable effectiveness.

PACS numbers:
The theory of horizontal visibility graphs (HVGs) [1][2][3] builds a bridge between nonlinear dynamics, time series analysis and graph theory by providing a recipe to map a time series of N data into a graph of N vertices and subsequently studying the topological properties of the resulting graph in direct correspondence with the structure and dynamical properties of the associated series. From a combinatoric point of view, HVGs are outerplanar graphs with a Hamiltonian path [4], i.e. noncrossing graphs as defined in algebraic combinatorics [5]. In recent years, this mapping has been successfully explored to provide a topological characterization of different routes to low dimensional chaos [6][7][8], or different types of stochastic and chaotic dynamics [3]. From an applied angle, this technique is being widely used to extract in a simple and computationally efficient way informative features for the description and classification of empirical time series appearing in several areas of physics including optics [9], fluid dynamics [10][11][12], geophysics [13] or astrophysics [14,15], and extend beyond physics in areas such as physiology [16,17], neuroscience [18] or finance [19] to cite only a few examples. Among the wealth of possible graph-theoretical measures that one could compute on a graph, it is noticeable that the most informative metrics include the degree and joint degree distributions (as well as some moments [8]), entropic quantities based on these distributions or sequential motifs [20], all these based on the same quantity: the degree sequence. Of course the degree sequence is just one out of many possible descriptors of a graph's topology [21,22], and in this sense it is an open and relevant question why, in the context of HVG theory, this simple and computationally * Electronic address: l.lacasa@qmul.ac.uk efficient quantity seems to be enough to describe the full complexity of a given time series. In this letter we provide a partial solution for this question, by proving that under suitable conditions (for a general family of HVGs labelled canonical) these graphs are uniquely determined by its degree sequence, i.e. they are so-called unigraphs [23][24][25]. In other words, we prove that for canonical HVGs the degree sequence is the measure that encapsulates all the information of the graph. To do that, we will need to introduce a list of definitions and propositions before stating the main theorem. We will give a constructive proof of the main theorem by giving an explicit bijection between the adjacency matrix and the degree sequence, and we finally will discuss some implications of this theorem.
Let S = {x 1 , . . . , x N }, x i ∈ R be a real-valued scalar time (or otherwise ordered) series of N data. Its horizontal visibility graph HVG(S) is defined as an undirected graph of N vertices, where each vertex i ∈ [1, N ] is labelled in correspondence with the ordered datum x i . Hence x 1 is related to vertex i = 1, x 2 to vertex i = 2, and so on. Then, two vertices i, j (assume i < j without loss of generality) share an edge if and only if x k < inf(x i , x j ), ∀k : i < k < j. This is an ordering criterion which can be visualized in figure 1. Now, for the latter series S, if (i) x 1 and x N are the two largest data in the series and (ii) the inner data are different x i = x j ∀i, j = 2, . . . , N − 1 then we call the series S canonical and its associated HVG is called a canonical HVG. The set of canonical HVGs is therefore a subset of all possible HVGs. The second condition is usually guaranteed for real-valued irregular time series (which are the objects under study in most of the applications), while even if the first condition is not easy to meet, for a given dynamical process it is not difficult to find a sample series of size N that is generated from the dynamical process and complies with the first condition. In general this is achieved by a procedure of series canonization: Series canonization. Consider again a sequence S = {x 1 , x 2 , . . . , x N } which is not canonical. One can canonize the sequence -i.e., construct an associated sequence which is canonical-using two different procedures, depending on the property that S is lacking. (ii) If x i+τ = x i for some τ > 0 (the sequence is periodic of period τ ) but the data do not repeat within a period: Locate the largest value of the series and label it x m . Then S c is a sequence with τ + 1 data formed by S * = {x m , x m+1 , . . . , x m+τ = x m }. (iii) if x i = x j for some i, j but the sequence is not periodic, or if the sequence is periodic and some data take identical values within a period, then the sequence cannot be canonized.
Note that any time series extracted from the trajectory of a stochastic dynamical system where the random variable takes values on R can be canonized using the procedure (i) almost surely. The same holds for the trajectories of aperiodic deterministic dynamical systems. For periodic sequences, one can apply the procedure (2). In general, if a series S is extracted from a given dynamical process, then its canonized version S c is also a possible realization of the same dynamical process with equal probability (that is, S and S c are equiprobable microstates). Before stating the main theorem, we just need to state the following: sequence of N data is a path graph of N vertices.
The detailed proof of this proposition is trivial and is therefore omitted (as a sketch, one proceeds by applying the visibility criterion to the three cases -monotonically increasing, monotonically decreasing, and constant series-). We are thus ready to state the main theorem of this paper. Theorem 1. If G is a canonical HVG of N vertices with adjacency matrix A and degree sequence k = (k 1 , k 2 , . . . , k N ), then there exists a bijection between A and k.
Proof. We construct this bijection explicitly. Consider the computable function f : {0, 1} N ×N → Ω where Ω ⊂ [N − {0, 1}] N is the subset of degree sequences that are admissible for HVGs. This function admits an inverse f −1 that puts the adjacency matrix A and the degree sequence k of a canonical HVG in bijection. Since f is trivially defined as f (A) = j A ij = k (where by construction k ∈ Ω), the challenging part and thus the strategy of this proof is to construct f −1 . In order to do that we first propose an algorithm that maps the degree sequence k into a certain matrix B and accordingly we prove that B = A. To further prove this latter part, we show that B is an adjacency matrix of the same order as A, then we show that every edge in B is also in A, and finally we show that the number of edges in B is the same as the number of edges in A.
Consider a HVG of order N with degree sequence k, and consider a replica of this degree sequence which we will update, where initially k (0) := [k 1 , k 2 , . . . , k N ]. Then f −1 (k) ≡ B is an element from the set {0, 1} N ×N which is constructed as follows: Setting: Start setting B ij = 0 ∀i, j, and B i,i+1 = B i+1,i = 1 ∀i = 1, . . . , N − 1. These links are obviously also present in A since k is associated to a HVG and then this graph has the trivial Hamiltonian path 1 − 2 − 3 · · · − N . An illustration of how the algorithm works in a concrete example is shown for illustration in figure 3.
Step 1 (Initial assignment of k = 2 nodes): Locate in k (0) those inner vertices j (where j ∈ [2, N −1]) with degree k j = 2. Note that this is always possible: the original time series {x i } has a finite number of elements, hence we can always find its minimum datum. This minimum is not in the boundary (j = 1, N ) as the series is canonical (the only pathological case where this cannot be done is when the time series is constant, which according to proposition 1 means that the HVG is the path graph). By construction, this minimum will be associated to a vertex in the HVG with degree 2. For each of these inner vertices, the associated data will be a local minimum (meaning that at least x j < x j−1 , x j+1 ), therefore there exists an edge between the neighbors of j in A. We update the adjacency matrix B j−1,j+1 = B j+1,j−1 = 1 ∀j accordingly. To carry track of the number of edges that we are introducing in B, we also update k (0) → k (1) by removing there the edges that were introduced in B. Thus ∀j such that k j = 2, k j = 2 → 0, k j+1 → k j+1 − 1 and k j−1 → k j−1 − 1. After step 1 the series has been decimated, and some edges have accordingly been deleted in k (·) . Incidentally, note that this process had been used previously in the context of a graph-theoretical renormalization group transformation [6].
Step > 1 (Iteration): We further locate in k (1) those vertices j that have been updated and now have k j = 2. For each of these vertices, we locate the closest vertices r and l (where r > j and l < j) for which k r > 0 and k l > 0. These are the new neighbors in the decimated series and accordingly B rl = B lr = 1. Note that by construction, we have x p < inf(x r , x l ) ∀p : l < p < r. This holds because all the data placed between l and r are either j or data that were already decimated. Therefore this new edge was also present in the original adjacency matrix, A rl = A lr = 1. Again, we carry track of these new edges by updating k (1) → k (2) such that k j = 2 → 0, k r → k r − 1, and k l → k l − 1. We repeat this last step iteratively (this is always possible as initially all data are different so the process of finding the smaller data is always possible). This iteration will set at each step the k j = 2 vertices to zero in the updating degree sequence and will decrease by one the value of their neighbors. The process stops after we have repeated this process an unknown number of times m and reach k (m) = [1, 0, . . . , 0, 1] which is the trivial absorbing state. Once this limit is reached the algorithm stops and we introduce the last edge, setting B 1N = B N 1 = 1 (which is also a link present in A as we are dealing with a canonical HVG) and update the degree sequence accordingly k (m+1) = [0, . . . , 0]. No more edges can be deleted in the degree sequence and no more edges can be added to B.
All in all, this procedure uses k (·) to construct a [0, 1] N ×N matrix B. As we have shown, all the new edges introduced in B (all the 1s) also belong to A. On the other hand, the total number of elements removed from k (0) is exactly twice the total number of edges that were introduced in B (if we take into account all steps in the algorithm above). Thus the number of edges introduced in B is 1 where E is the number of edges in the original HVG. Therefore there are no missing edges and B = A.

Concluding remarks.
To be able to put in bijection a graph's adjacency matrix with its degree sequence is a nontrivial result, as the adjacency matrix stores in principle N 2 entries, while the degree sequence only requires N of them. This optimal compression property is a very particular property of unigraphs, in this sense a straightforward corollary of our main result states that canonical HVGs are unigraphs, and thus this family of HVGs shares all their nice properties such as having linear recognition time (something that was proved independently for HVGs recently [4]). Note that the converse is not true, as it can be trivially proved by counterexam-ple or by the fact that HVGs are outerplanar and not all unigraphs are outerplanar. It should be highlighted that the canonicity condition can in some cases be relaxed, in the sense that in many instances the bijection described above works even for non-canonical HVGs. However for the theorem to hold we needed to restrict the set of HVGs to those that are canonical. We suspect that for most of the practical situations the theorem still holds, however this remains an open problem.
Nevertheless the theorem implies that all the information encoded in the graph is efficiently compressed in its degree sequence, giving a satisfying solution to the paradox of the unreasonable efficiency of this simple topological metric. This finding should allow HVG-based feature extraction algorithms to safely focus on the degree sequence, saving both memory allocation and execution time without losing information.