1 Introduction
When representing graphs, say with adjacency lists or matrices, vertex identifiers are usually just pointers in the data structure. In contrast, a graph is implicitly represented when each vertex of the graph carries enough information so that some properties, for instance adjacency, can be efficiently determined from the identifiers in a local manner (cf. [19, 26]). The standard example is that of interval graphs: if is an interval graph with vertices^{1}^{1}1Throughout the paper, is implicitly the number of vertices in the graph at hand., we can assign to each vertex some interval with integer endpoints so that are adjacent if and only if . Clearly, to represent it suffices to store the corresponding intervals. Although may have a quadratic number of edges, such an implicit representation uses bits per vertex^{2}^{2}2Throughout the paper, denotes the binary logarithm of .. Compact representations have several advantages, not only for memory storage, but also from algorithmic perspectives.
The route to more efficient representations is conceptually simple: it is a matter of exploiting the structure of the graph class to spell out as few adjacencies as possible and derive the rest from the existing information. On the other hand, how can we argue that a representation is best possible?
Let us define the problem more formally. We say that a graph class admits an adjacency labelling scheme with labels of bits if, for any integer , we can label the vertices of any vertex graph of with strings of bits such that, using only the labels assigned to and , we can determine whether and are adjacent in the graph. An adjacency labelling scheme is efficient if the encoding takes polynomial time and the decoding takes constant time in the word RAM model with words of bits (see Section 2.4 for the details). An adjacency labelling scheme describing a graph also describes all the induced subgraphs of , so it is customary to consider adjacency labelling schemes for hereditary classes of graphs, that is, classes of graphs that are closed under taking induced subgraphs.
Given a graph class and an integer , the set of vertex graphs^{3}^{3}3All the graphs considered in this paper are unlabelled, so all the graphs are considered up to isomorphism. of is denoted by . If admits an adjacency labelling scheme with labels of bits, then the total number of bits describing an vertex graph is , and thus . Given a class and an integer , let (we will write , if is clear from context). Note that for any . The observation above can be restated as follows.
Observation 1.1.
For every class , no adjacency labelling scheme for has less than bits per vertex.
A natural question is whether this lower bound of can be attained. There are examples of nonhereditary classes for which this lower bound cannot be attained [26], so in the remainder of the paper we only consider hereditary classes.
In the regime , the Implicit Graph Conjecture [19, 26] posits that every hereditary class with has an adjacency labelling scheme with labels of bits per vertex. Although the conjecture has been proved in some special cases, it is still open in general (see [7, 11] for recent results and references on the conjecture). Note that in this regime the conjecture only posits that there is an adjacency labelling scheme with labels of at most a constant times bits per vertex.
The purpose of our paper is to show that the lower bound is attained (up to lower order terms) in the denser regime , which also has many applications. We prove the following.
Theorem 1.2.
Let be a hereditary graph class. Then has an efficient adjacency labelling scheme using bits per vertex. This is tight up to the term.
Theorem 1.2 shows that in this regime, graphs from
can not only be compressed in an optimal way, but that the representation can be uniformly distributed among the vertices, with efficient encoding and decoding. To the best of our knowledge, this was already known only in the specific cases where
is the class of all graphs, or the class of all bipartite graphs (see [2, 6] for recent sharper results on these two classes).Note that Theorem 1.2 is applicable to a wide range of graph classes, for instance classes of graphs of bounded chromatic number (such as bipartite graphs), or classes of graphs excluding some (induced) subgraphs (such as perfect graphs, chordal graphs, or split graphs). An example is the class of string graphs on for some surface , i.e. the class of intersection graphs of continuous curves embedded in . It follows from [3, Corollary 3] that for this class , where denotes the size of the largest complete graph embeddable in . Using Theorem 1.2, this directly implies the following.
Corollary 1.3.
For any surface , the class of string graphs on has an efficient adjacency labelling scheme using bits per vertex, which is asymptotically tight.
Another interesting example for us is the class of graphs excluding the 5cycle as an induced subgraph. It is well known that for this class, we have (more will be said about this in Section 2.1). We thus obtain the following as an immediate consequence of Theorem 1.2.
Corollary 1.4.
The class of graphs with no induced has an efficient adjacency labelling scheme using bits per vertex, which is asymptotically tight.
Given a partially ordered set (poset, in short) , the comparability graph of is the graph whose vertices are the elements of , and in which two vertices are adjacent if and only if the two corresponding elements of are comparable. A graph is perfect if for any induced subgraph of , the chromatic number and the clique number of coincide. It is well known that comparability graphs are perfect. Note that the class of graphs with no induced contains the class of perfect graphs, and thus the class of comparability graphs, hence Corollary 1.4 also applies to these classes (and is tight for them as well).
The key ingredient in the proof of Theorem 1.2 is Szemerédi’s Regularity Lemma, which we describe in Section 2. The downside of this tool is that even though our results are best possible asymptotically, the term in Theorem 1.2 is an extremely slowly decreasing function of , and the "efficient" complexity of our encoding and decoding hides huge constants. In the case of comparability graphs (for which we present two important applications below), we can significantly improve the lower order term and the complexity of our encoding and decoding compared to Corollary 1.4.
Theorem 1.5.
The class of comparability graphs admits an adjacency scheme with labels of bits per vertex and an efficient adjacency labelling scheme with labels of bits per vertex.
We now describe two important consequences of Theorem 1.5 for comparability labelling schemes in posets and reachability labelling schemes in digraphs.
Comparability in posets
We say that a class of posets admits a comparability labelling scheme with labels of bits if for every integer , we can label the elements of any element poset of with strings of at most bits such that it can be determined whether and are comparable in the poset (and if so, whether ) using only the labels assigned to and .
Given a poset , we can consider a linear ordering of (i.e. an ordering such that whenever ). If each element stores its index (this costs bits), then whenever two elements and are comparable they can decide whether or by looking at their indices. Consequently, by appending indices of the elements to an adjacency labelling scheme for the comparability graphs of the posets in a class , we obtain a comparability labelling scheme for the class , with only additional bits per element. We thus obtain the following as an immediate consequence of Theorem 1.5.
Corollary 1.6.
The class of all posets admits a comparability labelling scheme with labels of bits per element and an efficient comparability labelling scheme with labels of bits per element.
Munro and Nicholson [24] proved that posets can be represented in bits in such a way that queries of the form ‘’ can be answered by inspecting only a constant number of bits. Corollary 1.6 shows that an encoding of the same total size can be obtained by distributing the information uniformly between the elements of the poset.
Reachability in digraphs
We say that a vertex can reach a vertex in a directed graph (digraph, in short) if there is a directed path in the digraph from to . We say that a class of digraphs admits a reachability labelling scheme with labels of bits if for any integer , we can label the vertices of any vertex digraph of with strings of at most bits such that it can be determined whether can reach in the digraph using only the labels assigned to and .
It is wellknown (see for instance [14]) that reachability queries in digraphs can be reduced to comparability queries in posets as follows. Given a digraph , we start by contracting each strong component of into a single vertex. Let be the resulting acyclic digraph, and suppose that ayclic digraphs have a reachability labelling scheme with labels of bits. Then a reachability labelling for can be turned into a reachability labelling for by giving to each vertex of the labelling in of the strong component containing , followed by a bit label uniquely identifying each strong component. This gives a reachability labelling scheme for all digraphs with labels of bits per vertex.
So it suffices to design a reachability labelling for acyclic digraphs. Given an acyclic digraph , and two vertices in , we write if there is a directed path from to . Since is acyclic, forms a poset and comparability queries in this poset are precisely reachability queries in . This immediately implies the following.
Corollary 1.7.
The class of all digraphs admits a reachability labelling scheme with labels of bits per vertex and an efficient reachability labelling scheme with labels of bits per vertex.
This improves upon a recent result by Dulęba, Gawrychowski and Janczewski [14], who proved that digraphs admit an efficient reachability labelling scheme with labels of size .
Induceduniversal graphs and posets
Forgoing all complexity concerns, efficient labelling (resp. reachability, comparability) schemes for a class of graphs or posets can be seen from a purely structural perspective, which is that of universal graphs and posets.
Given a graph class , we say that admits induceduniversal graphs on vertices if for every , there is a graph on vertices that contains every vertex element of as an induced subgraph. The definition can be transposed to posets in a natural way.
As observed in [19, 20], admitting universal graphs on vertices is equivalent to admitting an adjacency labelling scheme using bits^{4}^{4}4Here we need to add the condition that the encoding function is injective, which in general only costs additional bits per vertex and can thus be included in the lower order term.. Indeed, to label an vertex element of , it suffices to embed it in the universal graph on vertices as an induced subgraph, and label its vertices with their corresponding names in the universal graph. Conversely, given an adjacency labelling scheme using bits, we define a universal graph on vertices as follows. Let all possible labels on bits form its vertex set, and let the edges be defined by the labelling scheme applied to each pair of labels. The resulting graph has vertices and contains every vertex element of as induced subgraph.
Theorem 1.2 and Corollary 1.6 therefore have immediate transpositions in the realm of induceduniversal graphs and posets.
Corollary 1.8.
Let be a hereditary graph class. Then for any integer there is a graph on vertices containing all vertex graphs of as induced subgraph. This is optimal up to the lower order term. Moreover the construction of this graph is explicit and any vertex graph of can be efficiently embedded in .
Corollary 1.9.
There is a sequence of posets , with , such that each element poset is contained in . This is best possible, up to the lower order term. Moreover the construction of is explicit and any element poset can be embedded in efficiently.
The poset case is of specific interest, answering a question raised by Hamkins in 2010 [18].
Organisation of the paper
We outline the results from the literature that we will need in Section 2. We make use of nearoptimal dictionaries, for which we state the required results in Section 2.4. We prove Theorem 1.2 in Section 3. In Section 4 we give a labelling scheme for comparability graphs with a tradeoff between the number of bits used for the labels and the decoding time and then deduce Theorem 1.5. We conclude with some remarks and open problems in Section 5.
2 Preliminaries
In the section, we state the auxiliary results from the literature that we need for the proofs of Theorem 1.2. and Theorem 1.5.
2.1 Hereditary classes
Let be the set of graphs whose vertex set can be partitioned into cliques and independent sets. The colouring number of a graph class is the supremum of the integers for which there exist with such that (it can easily be checked that is finite if and only if is not the class of all graphs). The following was proved by Alekseev [1] and Bollobás and Thomason [9, 10].
Theorem 2.1 (AlekseevBollobásThomason [1, 9, 10]).
Let be a hereditary class of graphs with . Then
Note that if a hereditary class contains all bipartite graphs or all split graphs, then and thus and by Theorem 2.1. This applies in particular to the class of comparability graphs, and to any class of graphs excluding some nonbipartite graph (such as ) as an induced subgraph.
On the other hand, observe that for any with , the 5cycle is contained in . This shows that if is the class of graphs with no induced , then , and thus by the paragraph above. By Theorem 2.1, and the paragraph above this implies that and , and the same applies to the class of comparability graphs.
2.2 Regularity
For a graph and two disjoint subsets of vertices , let denote the number of edges of with an endpoint in and an endpoint in . If and are nonempty, define the density of edges between and by . For , the pair is called regular if for every and with and .
An regular partition of the set of vertices of a graph is a partition of into pairwise disjoint vertex sets , for some , such that

;

;

all but at most of the pairs for are regular.
The fact that such partitions exist with a number of parts depending only on (and not on the size of the graph) is the wellknown Szemerédi Regularity Lemma. We will need an efficient constructive version of this lemma.
Lemma 2.2 (Algorithmic version of Szemerédi Regularity Lemma [4]).
For every and , there is an integer such that for every graph with vertices, the graph has an regular partition where . Moreover, such a partition can be found in time , where is the exponent of matrix multiplication.
It should be noted that has a “terrible” dependence in [4]: the iterated logarithm (the number of times we have to iterate the logarithm to go from to 1) is a polynomial in .
The edges between pairs of parts of low or high density will be easy for us to label using the dictionaries of the next section, and we can also label the irregular edges since there are not too many of those. These edges will only contribute to the term. The following two results allow us to show that the remaining edges (those between pairs that are both regular and neither dense nor sparse) contribute exactly the leading term we are aiming for. Recall that was defined in Section 2.1.
Lemma 2.3 (Lemma 10 in [3]).
Given and , there exist an and such that the following holds. Let be a graph with disjoint vertex sets such that for all , and the pair is regular and of density at least and at most for all distinct . Then there exist with such that contains all graphs from of at most vertices as induced subgraphs.
We will also need the following classical result in extremal graph theory.
Theorem 2.4 (Turán’s theorem [28]).
Let . Any free graph on vertices has at most edges.
2.3 Orientations and bipartite graphs
An orientation of an undirected graph is a directed graph obtained from by choosing one of the two possible directions for each edge of . We use the following result to efficiently label adjacencies in graphs that are not very dense.
Lemma 2.5 (Lemma 3.1 in [5]).
A graph has an orientation in which every outdegree is at most if and only if
For the results of Section 4 we also need an optimal adjacency labelling scheme for bipartite graphs from [14]. A scheme with labels of the same order, but with a better lower order term can also be deduced from [2] or [6], but without an explicit decoder.
Lemma 2.6 (Theorem 3.2 in [14]).
The class of bipartite graphs has an adjacency labelling scheme with labels of size at most . The labelling can be constructed in time and adjacency queries can be answered in constant time in the word RAM model with words of size . In fact, the decoding scheme inspects at most ten bit words.
2.4 Succinct dictionaries for neighbourhoods
Throughout this paper, stands for the logarithm to the base 2, and the natural logarithm is denoted by .
We will need an encoding of subsets of from which we can answer membership queries such as “?” efficiently. It is easy to encode a subset of size at most from by using bits to write down the size of the subset and then the elements in increasing order (each element in base 2, as a bit word). Membership queries can then be performed using binary search. This gives the following folklore result which will suffice for the proof of Theorem 4.1.
Theorem 2.7 (Folklore dictionaries).
For any integer and , any subset of of size at most can be encoded in time using at most bits of storage, such that membership queries can be answered by inspecting at most bits.
A more efficient scheme has been introduced by Fredman, Komlós and Szemerédi [16], but this would not significantly impact the asymptotics of our decoding time in the proof of Theorem 4.1 and we therefore opt to use the simplest solution.
For our other results, we will use a scheme that encodes subsets using a number of bits close to the informationtheoretic minimum, while also requiring only constant query time in the classical word RAM model [17]. In this model we have access to an array whose cells contain bit words (or equivalently integers in the interval ). Each word can be accessed in constant time. Moreover, usual arithmetic operations between integers in the interval and bitwise logical operations between bit strings can be performed in constant time as well. The constant decoding time for Theorem 1.2 and Theorem 4.2 are all measured in this model as well as the constant decoding time from the earlier work of Dulęba, Gawrychowski and Janczewski [14] on reachability labelling schemes.
The informationtheoretic minimum for encoding subsets of of size is bits. Let denote the binary entropy function. Then where as . Theorem 1.1 in Pagh [25] shows that subsets of size from can be encoded at the informationtheoretic minimum up to lower order terms with constant membership query time in the word RAM model. By adding at most elements to the universe , we can complete all sets of at most elements of into element subsets of . We obtain the following corollary.
Theorem 2.8 (Efficient static dictionaries [25]).
For any integer and , subsets of size at most from can be encoded in time using at most
bits of storage, with constant membership query time in the word RAM model with word size .
A similar result was obtained by Brodnik and Munro in [12], with a slightly worse lower order term and no explicit analysis of the time complexity of the encoding.
Our main use of Theorem 2.8 is in the following form.
Corollary 2.9.
Let be given. For every vertex graph with an orientation on the vertices in which each vertex has outdegree at most , we can encode the adjacencies of the graph in time using labels of at most bits per vertex, with constant adjacency query time in the word RAM model with word size .
To see how this follows from Theorem 2.8, note that we can number the vertices of the graph with the elements of and can then let each vertex store the set of its outneighbours. Deciding whether two vertices and are adjacent is equivalent to deciding whether lies in the outneighbourhood of or lies in the outneighbourhood of .
3 Adjacency labelling in hereditary classes
We show that, for every hereditary class of graphs , there is an efficient adjacency labelling scheme using bits per vertex. By Theorem 2.1 and Observation 1.1, this directly implies the result.
Proof of Theorem 1.2.
Let be a hereditary graph class, with . We can assume that is finite, by using the simple adjacency labelling scheme of Moon [22] with labels of at most bits if is the class of all graphs (see also [2, 6] for more recent work on this case). We will show that there exists a continuous function such that as and a function , such that for all , for all on vertices, we can construct labels of at most bits per vertex in time , such that it can determined from the labels of two vertices whether they are adjacent.
By definition of the colouring number, for all such that , there exists a graph such that . Let , where the maximum is taken over the (finite number of) such that .
Let be given and let and be given from Lemma 2.3 applied for the and defined above and . We set and . Let be given from Lemma 2.2. We set .
Let be an vertex graph with . We apply Lemma 2.2 to to find an regular partition of in time with parts. Note that depends on and but does not depend on . By definition of and we find for all . We define a 4colouring of the edges of the complete graph with vertex set , as follows.

We colour the edge red if is not regular.

We colour the edge black if and is regular.

We colour the edge white if and is regular.

We colour the edge grey if and is regular.
Using a constant number of bits, we store this auxiliary graph of constant size (including the colour of the edges) in the label of each vertex. We also store the size of the corresponding parts of (note that it suffices to store and since , which takes at most bits). Recall that for all . We order the vertices within their own part arbitrarily. For each vertex , we record the index of the part containing , as well as the position of in the order on . We then allocate a further bits for each vertex, where the th bit encodes whether is adjacent to the th vertex of its part. Furthermore, we allocate an additional bits to record the adjacencies from each vertex to the part .
It now remains to encode the adjacencies between and for . For this, we apply different labelling schemes depending on the colour of the edge .
We first consider the grey edges.
Claim 3.1.
The subgraph of induced by the grey edges can be oriented so that each vertex in has outdegree at most .
Proof.
Suppose that contains a copy of induced on and set for . Since , the pairs are regular for all distinct . By Lemma 2.3, we find that there exist with such that contains an induced copy of every graph in on at most vertices. In particular contains an induced copy of . Since is hereditary, we find , a contradiction.
Let be an orientation of the edges of such that every vertex has outdegree at most . We now encode the corresponding adjacencies in as follows. For each vertex (with ), we encode the set of elements for which is oriented from to in . We then encode the adjacencies between and naively by appending a bit string of length to its label, where (as before) the th bit in the string indicates whether or not is adjacent to the th vertex of . By the bound on the outdegrees in the orientation of , this adds a total of at most
bits to each label, plus a constant number of bits for storing the corresponding outneighbourhood of in .
We now take care of the red edges.
Claim 3.2.
The subgraph of induced by the red edges can be oriented so that each vertex in has outdegree at most .
Proof.
It is enough to show that is degenerate, i.e. has a vertex ordering such that each vertex has at most neighbours preceding it in the order (note that given such ordering, orienting all edges from successors to predecessors gives the desired orientation). If is not degenerate, then it contains a subgraph of minimum degree more than , and thus with more than vertices. It follows that contains at least edges, contradicting the fact that , as a subgraph of , contains at most edges. ∎
By the claim, we can encode the edges in corresponding to the red edges using at most bits as in the case of the grey edges. Indeed, we fix an orientation satisfying the claim, and use a constant number of bits to record the orientation. For each and each pair such that is a red edge that has been oriented from to in the orientation of resulting from the claim above, we record the adjacencies from to naively using a bit string of length . Since the outdegrees in the red graph are at most , this adds a total of at most bits to each label.
We next turn our attention to the white edges. Recall that a white edge corresponds to an regular pair of density at most .
Claim 3.3.
Let be a pair corresponding to a white edge . Then we can find in time an orientation of the edges between and so that each vertex has outdegree at most .
Proof.
As in the previous claim, it is enough to show that the subgraph of induced by the edges between and is degenerate (finding the corresponding vertex ordering can easily be done in time ). If it is not, then it contains some nonempty subgraph with minimum degree more than . Let and be the intersection of the vertex set of this subgraph with and , respectively. But then (where we have used and ) while . This contradicts the fact that is an regular pair of density at most . ∎
Let be the (bipartite) subgraph of induced by all the edges connecting sets and such that is a white edge. The claim above implies that has an orientation such that each vertex has outdegree at most . Hence by Corollary 2.9, we can encode the adjacencies of using at most bits.
The black edges can be handled similarly, by encoding nonadjacencies instead of adjacencies. More specifically, we consider the graph with vertex set in which we add an edge between and whenever is a black edge and are not adjacent in (in other words, we consider the complement of and only keep edges between pairs of sets such that the edge is black). By symmetry, the analysis above shows that this graph has an orientation such that each vertex has outdegree at most , and we can again apply Corollary 2.9.
In total, we used at most
bits in each label. Note that and that as . So we have proved that for sufficiently large that the labels have at most
bits for a function such that when . This completes the analysis of the length of the labels.
We now explain how the decoder works. Given vertices , the decoder first reads off the indices with and . If then the decoder reads the position of in the order on , and reads off whether is adjacent to from the label of . A similar procedure applies if or if . So we may assume . We read off the colour of the edge in the auxiliary graph from the label of either of the two vertices, and depending on the colour we read different parts of the labels again.
For grey or red edges, we read off the orientation of the grey or red subgraphs respectively to determine whether encoded the adjacency or vice versa, and can then find the desired bit in the string of either or that encodes whether there is an edge between and . For the black or white edges, we jump to the part of the label of that encodes the adjacencies (or nonadjacencies) between and the sets such that is a white or black edge. The bit string stored there is used to do a membership test as to whether is part of the special set stored for corresponding to its outneighbourhood in the orientation of Claim 3.3. If the edge is white we need a positive answer to the membership test, while if is black we want a negative answer. This can be done in constant time by Corollary 2.9. We then repeat this procedure with and switched in order to determine whether and are adjacent. ∎
4 Adjacency labelling in comparability graphs
We first give the simple version of our labelling scheme for comparability graphs, which allows for a tradeoff between the number of bits used for the label and the decoding time (measured here by the number of bits inspected by the decoder).
Theorem 4.1.
For any , the class of comparability graphs has an adjacency labelling scheme with labels of at most
bits (assuming ), which can be constructed in time . Moreover the decoder only needs to inspect at most bits.
Proof.
Let be a comparability graph with underlying partial order . The partial order induces a natural orientation of the edges of , by orienting each edge with from to . In the remainder of the proof, it will be convenient to mix the notation for oriented graphs ( and for the outneighbourhood and inneighbourhood of , for instance) with the notation for posets. We first take a linear ordering of (i.e. an ordering such that if then ) and let each vertex store its position in the order (this uses a single word of bits).
Given a pair of vertices of with , we say that a vertex is covered by the pair if . We say that a pair of vertices of with is heavy if the number of vertices covered by the pair is at least for . Note that for every heavy pair , we have . Any pair of vertices of that is not heavy is said to be light (in particular all pairs of nonadjacent vertices in are light). Observe that if is a heavy pair and is a vertex of chosen uniformly at random, then is covered by the pair
(in the sense defined above) with probability at least
. It follows that for any collection of heavy pairs in , there is a vertex covered by a fraction of at least of the heavy pairs of , and such a vertex can be easily found in time .We now construct a set of at most vertices as follows. Let be the set of all heavy pairs in . As long as and , we find a vertex covered by a fraction of at least of the pairs of , as described above. We then add to and remove from all the pairs covering . Each time we add an element to , the size of is multiplied by a factor at most , so there is no heavy pair remaining after this procedure, since . So, the set has the property that for any heavy pair , there is a vertex such that or (i.e. the heavy pair covers ). Moreover, can be constructed in time .
We now arbitrarily order the elements of as , and each vertex of stores its index . Each vertex of stores a bit string of bits such that the th bit of the string tells whether and the th whether . For any pair , we can find whether there is a vertex such that by inspecting at most bits. This is enough to determine adjacencies for all heavy pairs, as for any heavy pair , there is an edge between and if and only if there is a vertex such that or (and such a vertex can be identified by inspecting the labels of and ).
It remains to determine adjacencies between light pairs of vertices. We consider the subgraph of induced by all edges such that forms a light pair. As explained above, it remains to find an adjacency labelling of this subgraph. In this paragraph we fix a vertex in , and let denote the subgraph of induced by the inneighbourhood in . Note that each vertex of has outdegree at most in , since otherwise would form a heavy pair, and thus would not be adjacent in . We claim that the adjacencies of can be labelled using at most bits in the label of each vertex of . Each vertex stores the set of indices of its outneighbours in using at most bits via the scheme of Theorem 2.7 (using ). This reduces determining whether two vertices are adjacent in to two membership queries: “is in the outneighbourhood of in this graph?” and “is in the outneighbourhood of in this graph?”). The two membership queries require reading at most bits and the encoding can be done in time .
Similarly, if we denote by the subgraph of induced by the outneighbourhood in , then we can encode the adjacencies in efficiently because each vertex of has indegree at most in . Later in the proof, we will use this scheme for a handful of wellchosen vertices of , with the goal of covering most of the light edges of with few graphs and .
We say that a vertex of is a hub if it has indegree and outdegree at least in with . Otherwise is said to be a nonhub. Recall that a pair covers if or . Observe that if we take a pair of vertices uniformly at random in , then any given hub is covered by the random pair with probability at least . It follows that for any collection of hubs, there is a pair in that covers a fraction of at least of the vertices in the collection, and such a pair can be found in time . Hence we may find a set of vertices of size at most , with , in time , such that all hubs are covered by some pair of , since
For each vertex we store the adjacencies inside and as explained above, at a total cost of bits in the label of each vertex of .
For each hub , we encode a pair in with in the label of . That uses at most bits. For any neighbour of in , either in which case , or in which case . Hence we can hence determine whether a hub and some vertex are adjacent in by inspecting the adjacency labelling schemes corresponding to , , and , where is a heavy pair of (encoded in the label of ) that covers . This last step requires reading at most bits in the labels of and .
It remains to handle the adjacencies between nonhubs. Let . By definition of nonhubs, in the subgraph of induced by these vertices, all vertices have outdegree at most or indegree at most . Let be the set of vertices of outdegree at most , and let be the set of vertices of of indegree at most . By the same argument as we used to label the adjacencies of above, we can record the adjacencies in the subgraph of induced by and in the subgraph induced by at a cost of at most bits in the label of each vertex using Theorem 2.7. The subgraph induced by the edges between and is bipartite, so we can record the adjacencies in this subgraph at a cost of bits in the label of each vertex by Lemma 2.6. When deciding if is adjacent to from the labels, we first read their index in the linear order and then at most bits to see if one is in the in or outneighbourhood of the other. If this is not the case, we then inspect a further at most bits (by Lemma 2.6) to verify if the vertices are adjacent in . The vertices and are adjacent if and only if at least one of these two tests has a positive answer.
We can hence label the adjacencies between the nonhubs at a cost of at most bits in the label of each vertex, and the decoder for the adjacencies in this subgraph inspects at most bits of the labels.
In total, each label has at most
bits. Moreover the labelling can be constructed in time and the decoding can be done by inspecting at most bits. ∎
Setting , Theorem 4.1 gives labels of bits with encoding time and decoding time . With , we obtain labels of bits with encoding time and decoding time .
In order to get the constant decoding time required for Theorem 1.5, we perform a tighter analysis of the proof above to show the following result.
Theorem 4.2.
The class of comparability graphs admits an adjacency labelling scheme with labels of
bits, with constant query time in the wordRAM model with words of size . The encoding can be done in time .
Sketch.
We follow the proof of Theorem 4.1. When creating the set of vertices, since we do not necessarily make large enough, there may be some heavy pairs that do not cover any vertex of . Let denote those pairs. We set so that
Let be the (undirected) subgraph of induced by all edges such that is a heavy pair from . Then the vertices of can be ordered greedily as such that each vertex has at most neighbours preceding it in the order. Indeed, if a subgraph of had minimum degree at least , then it would have at least vertices and hence would have at least edges, contradicting the fact that . This gives us an orientation of in which each vertex has outdegree at most . Using Corollary 2.9, we find an adjacency labelling for with labels of size
in time with constant query time.
Similarly, when constructing the set of size , we might have some hubs remaining that do not have a pair with . We set so that this set of remaining hubs has size at most
We apply Corollary 2.9 to encode the neighbourhoods for each vertex of using at most bits.
For , the out and indegree in and respectively are bounded by . When encoding the adjacencies of the graphs and , we use Corollary 2.9 instead of Theorem 2.7 to encode the neighbourhoods. The graph induced by the nonhubs has for each vertex either the in or the outdegree bounded by . To encode the adjacencies in these graphs, we again apply Corollary 2.9. In total, we used at most
bits. It can be checked that for . The result now follows by setting