A (distributed) labeling scheme is a way of distributing the global representation of a graph over its vertices, by giving them some local information. The goal is to be able to answer specific queries using only local knowledge. Peleg  gave a wide survey of the importance of such localized data structures in distributed computing and of the types of queries based on them. Such queries can be of various types (see  for a comprehensive list), but adjacency, distance, or routing can be listed among the most fundamental ones. The quality of a labeling scheme is measured by the size of the labels of vertices and the time required to answer the queries. Adjacency, distance, and routing labeling schemes for general graphs need labels of linear size. Labels of size or are sufficient for such schemes on trees. Finding natural classes of graphs admitting distributed labeling schemes with labels of polylogarithmic size is an important and challenging problem.
In this paper we investigate distance labeling schemes. A distance labeling scheme (DLS for short) on a graph family consists of an encoding function that gives binary labels to vertices of a graph and of a decoding function that, given the labels of two vertices and of , computes the distance between and in . For , we call a labeling scheme a -approximate distance labeling scheme if the decoding function computes an integer comprised between and .
By a result of Gavoille et al. , the family of all graphs on vertices admits a distance labeling scheme with labels of bits. This scheme is asymptotically optimal because simple counting arguments on the number of -vertex graphs show that bits are necessary. Another important result is that trees admit a DLS with labels of bits. Recently Freedman et. al  obtained such a scheme allowing constant time distance queries. Several graph classes containing trees also admit DLS with labels of length : bounded tree-width graphs , distance-hereditary graph , bounded clique-width graphs , or planar graphs of non-positive curvature . More recently, in  we designed DLS with labels of length for cube-free median graphs. Other families of graphs have been considered such as interval graphs, permutation graphs, and their generalizations [4, 18] for which an optimal bound of bits was given, and planar graphs for which there is a lower bound of bits  and an upper bound of bits . Other results concern approximate distance labeling schemes. For arbitrary graphs, Thorup and Zwick  proposed -approximate DLS, for each integer , with labels of size . In , it is proved that trees (and bounded tree-width graphs as well) admit -approximate DLS with labels of size , and this is tight in terms of label length and approximation. They also designed -additive DLS with -labels for several families of graphs, including the graphs with bounded longest induced cycle, and, more generally, the graphs of bounded tree–length. Interestingly, it is easy to show that every exact DLS for these families of graphs needs labels of bits in the worst-case .
Finding natural classes of graphs admitting exact or approximate distance labeling schemes with labels of polylogarithmic size is an important and challenging problem. In this paper we continue the line of research we started in  to investigate classes of graphs with rich metric properties, and we design approximate distance labeling schemes of polylogarithmic size for -free bridged graphs. Together with hyperbolic, median, and Helly graphs, bridged graphs constitute the most important classes of graphs in metric graph theory [3, 6]. They occurred in the investigation of graphs satisfying basic properties of classical Euclidean convexity: bridged graphs are the graphs in which the neighborhoods of convex sets are convex and it was shown in [13, 24] that they are exactly the graphs in which all isometric cycles have length 3. A local-to-global characterization of bridged graphs was found in : they are exactly the graphs whose clique complexes are simply connected and the neighborhoods of vertices do not containing induced 4- and 5-cycles. This result was rediscovered in , where such graphs and complexes were called systolic. Bridged (alias systolic) graphs and complexes have been thoroughly investigated in graph theory and in geometric group theory. A -free bridged graph is a bridged graph not containing 4-cliques. From the point of view of structural graph theory, -free bridged graphs are quite general: any graph of girth may occur in the neighborhood of a vertex of a -free bridged graph. Moreover, they may contain any complete graph as a minor. In Fig. 1 we present two examples of -free bridged graphs. The main result of this paper is the following:
The class of -free bridged graphs on vertices admits a -approximate distance labeling scheme using labels of bits. These labels are constructed in polynomial time and can be decoded in constant time.
The remaining part of this paper is organized in the following way. The main ideas of our distance labeling scheme are informally described in Section 2. Section 3 introduces the notions used in this paper. The next three Sections 4, 5, and 6 present the most important geometric and structural properties of -free graphs, which are the essence of our distance labeling scheme. In particular, we describe a partition of vertices of defined by the star of a median vertex. In Section 7 we characterize the pairs of vertices connected by a shortest path containing the center of this star. The distance labeling scheme and its performances are described in Section 8.
2. Main ideas of the scheme
The global structure of our distance labeling scheme for -free bridged graphs is similar to the one described in 
for cube-free median graphs. Namely, the scheme is based on a recursive partitioning of the graph into a star and its fibers (which are classified as panels and cones). However, the stars and the fibers of-free bridged graphs have completely different structural and metric properties from those of cube-free median graphs. Therefore, the technical tools are completely different from those used in .
Let be a -free bridged graph with vertices. The encoding algorithm first searches for a median vertex of , i.e., a vertex minimizing . It then computes a particular -neighborhood of that we call the star of such that every vertex of is assigned to a unique vertex of . This allows us to define the fibers of : for a vertex , the fiber of corresponds to the set of all the vertices of associated to . The set of all fibers of defines a partitioning of . Moreover, choosing as a median vertex ensures that every fiber contains at most the half of the vertices of . The fibers are not convex, nevertheless, they are connected and isometric, and thus induce bridged subgraphs of . Consequently, we can apply recursively the partitioning to every fiber, without accumulating errors on distances at each step. Finally, we study the boundary and the total boundary of each fiber, i.e., respectively, the set of all vertices of a fiber having a neighbor in another fiber and the union of all boundaries of a fiber. We will see that those boundaries do not induce actual trees but something close that we call “starshaped trees”. Unfortunately, these starshaped trees are not isometric. This explains why we obtain an approximate and not an exact distance labeling scheme. Indeed, distances computed in the total boundary can be twice as much as the distances in the graph.
We distinguish two types of fibers depending on the distance between and : panels are fibers leaving from a neighbor of ; cones are fibers associated to a vertex at distance from . One of our main results towards obtaining a compact labeling scheme establishes that a vertex in a panel admits two “exits” on the total boundary of this panel and that a vertex in a cone admits an “entrance” on each boundary of the cone (and it appears that every cone has exactly two boundaries). The median vertex or those “entrances” and “exits” of a vertex on a fiber are guaranteed to lie on a path of length at most four times a shortest -path for any vertex outside . At each recursive step, every vertex has to store information relative only to three vertices (, and the two “entrances” or “exits” of ). Since a panel can have a linear number of boundaries, without this main property, our scheme would use labels of linear length because a vertex in a panel could have to store information relative to each boundary to allow to compute distances with constant (multiplicative) error. Since we allow a multiplicative error of at most, we will see that in almost all cases, we can return the length of a shortest -path passing through the center of the star of the partitioning at some recursive step. Lemmas 14 and 15 indicate when this length corresponds to the exact distance between and and when it is an approximation of this distance. The cases where and belong to distinct fibers that are “too close” are more technical and are the one leading to a multiplicative error of 4.
All graphs in this note are finite, undirected, simple, and connected. We write if two vertices and are adjacent. The distance between and is the length of a shortest -path in . The interval between and consists of all the vertices on a shortest –paths. In other words, denotes all the vertices (metrically) between and : . Let be a subgraph of . Then is called convex if for any two vertices of . The convex hull of a subgraph of is the smallest convex subgraph containing . A connected subgraph of is called isometric if for any vertices of ; if is a cycle of , we call an isometric cycle. The metric projection of a vertex on is the set . For a subset , the neighborhood of in is the set . When is a singleton , then is the closed neighborhood of . The ball of radius centered at is the set . Note that .
A graph is bridged if any isometric cycle of has length 3. As shown in [13, 24], bridged graphs are characterized by one of the fundamental properties of CAT(0) spaces: the neighborhoods of all convex subgraphs of a bridged graph are convex. Consequently, balls in bridged graphs are convex. Bridged graphs constitute an important subclass of weakly modular graphs: a graph family that unifies numerous interesting classes of metric graph theory through “local-to-global” characterizations . Weakly modular graphs are the graphs satisfying the following quadrangle (QC) and triangle (TC) conditions [1, 7]:
(QC) with , , and , s.t. and .
(TC) with , and , s.t. and .
Bridged graphs are exactly the weakly modular graphs with no induced cycle of length or .
A metric triangle of a graph is a triplet of vertices such that for every , . A metric triangle is equilateral if . Weakly modular graphs can be characterized via metric triangles in the following way :
 A graph is weakly modular if and only if for any metric triangle of and any , the equality holds.
In particular, every metric triangle of a weakly modular graph is equilateral. A metric triangle is called a quasi-median of a triplet if for each pair there exists a shortest -path passing via and . Each triplet of vertices of any graph admits at least one quasi-median: it suffices to take as a furthest from vertex from , as a furthest from vertex from , and as a furthest from vertex from .
We conclude this section with the classical Gauss-Bonnet formula, which will be useful in some our proofs. Let be a plane graph and let denote the cycle delimiting its outer face. We view the inner faces of of length as regular -gons of the Euclidean plane; each of their angles must be equal to . For all vertices of , let denote the sum of the angles of the inner faces of containing . In other words, if denotes the set of all inner faces of containing , then
For all , we set , and for all inner vertices of we set . The parameters and measure the “defect” of the angles around (i.e., the gap between the actual value of the angles around , and the value or that should be the correct one if the polygons were “really embeddable” in the Euclidean plane). A discrete version of Gauss-Bonnet’s Theorem (see ) establishes the following formula (an example is given on Fig. 2):
Theorem 2 (Gauss-Bonnet).
Let be a planar graph. Then,
4. Metric triangles and intervals
From now on we suppose that is a -free bridged graph. A flat triangle is an equilateral triangle in the triangular grid; for an illustration see Fig. 3 (left). The interval between two vertices of the triangular grid induces a lozenge (see Fig. 3, right). A burned lozenge is obtained from by iteratively removing vertices of degree ; equivalently, a burned lozenge is the subgraph of in the region bounded by two shortest -paths. The vertices of a burned lozenge are naturally classified into boundary and inner vertices, and border vertices classified into concave and convex corners. We denote the convex hull of a metric triangle of by and call it a deltoid. The following two lemmas were known before for -free planar bridged graphs (see for example, [2, Proposition 3] for the first lemma) but their proofs remain the same.
Any deltoid of is a flat triangle.
Any interval of induces a burned lozenge.
We now introduce starshaped sets and trees, and we describe the structure of the intersection of an interval and a starshaped tree. Let be a tree rooted at a vertex . A path of is called increasing if it is entirely contained on a single branch of , i.e., if , either , or . A subset of the vertices of a graph is said to be starshaped relatively to a vertex if for all . If, additionally, all induce (shortest) paths of , then is called a starshaped tree (rooted at ).
Let be a starshaped tree of (rooted at ), and let . Then is contained in the two increasing paths joining to the two first non-degenerated convex corners of (these corners are said to be extremal relatively to ).
Let . Since , is a forest. Pick two vertices and of . Then implies that . Since belongs to and is starshaped, necessarily . It follows that and . Consequently, is a starshaped tree.
According to the structure of described in Lemma 2, every vertex of has at most two children. We have to show that, for any , either is a leaf, or has exactly one child which is either a border or a convex corner. Moreover, if is a non-degenerated convex corner, then it is a leaf of . Assume by way of contradiction the converse. The two possible children of are borders or convex corners. We thus consider the closest vertex to in having as child an inner vertex or a concave corner . Note that has to be either a border or a convex corner, otherwise we would have chosen one of its ancestors as a counterexample. Using again the structure of , we know that there exists a vertex such that and . On the one hand, if had belonged to , we would have chosen its parent instead of . On the other hand, if does not belong to , then it contradicts the hypothesis of being starshaped. ∎
5. Stars and fibers
Let be an arbitrary vertex of . Since is bridged, is convex. Note that for any , cannot belong to the metric projection . Indeed, necessarily has a neighbor on a shortest -path. This is closer to than , and it belongs to . Since is -free and weakly modular, we obtain the following property of projections on .
consists of a single vertex or of two adjacent vertices.
Let be a vertex with two vertices in . By Lemma 4 and triangle condition, there exists a vertex at distance from . Moreover, . The star of a vertex consists of plus all having two neighbors in , i.e., all that can be derived by the triangle condition; see Fig. 4 (left) for an example.
Let . If , we define the fiber of with respect to as the set of all vertices of having as unique projection on . Otherwise (if ) denotes the set of all vertices such that consists of two adjacent vertices and , and such that is adjacent to and is one step closer to than and . A fiber such that is called a panel. If , then is called a cone. Two fibers and are called -neighboring if .
Each fiber is starshaped with respect to .
Pick and . If is a cone, then and , whence . This implies that . Indeed, assume that and consider and with . By Lemma 7, . This contradicts that . Now, if is a panel and belongs to a fiber , then has to be a cone 1-neighboring (by Lemma 6). Consequently, must belong to a shortest -path passing via , contrary to . ∎
Let and . If the fibers and are both cones or are both panels, then the vertices and are not adjacent.
Suppose . Notice that this implies that . Indeed, if , then and if , then .
First, let and be two cones. If and are 1-neighboring , then and will contain a forbidden , or . If and are 2-neighboring, then there exists a vertex adjacent to and and at distance to and . Then and , contrary to convexity of . Thus, the cones and are -neighboring for some . By the triangle condition, there exists a vertex at distance from . This vertex can belong neither to nor to . Indeed, as a neighbor of and at distance from , if belongs to (or, to ), then would be at distance from , and thus would be at distance from . But then either and should coincide (which would be in contradiction with our hypothesis), or should have more than two vertices in the projection on (which is impossible by Lemma 4). Let and , and consider distinct from and from . Since and , we obtain that . Since and cannot be at distance from more than two vertices of each, . It follows that and have to be 2-neighboring, a contradiction.
Now, let and be two panels. Since and , and . Since , is convex, and must be adjacent. Since and are adjacent and are at distance from , there exists a vertex with . This vertex can belong neither to nor to , otherwise, if say belongs to , then would be at distance from and from , thus would belong to a cone and not to a panel. Since , there exists at distance from . So belongs to a cone with . From the equality , it follows that . But then, leads to , which is impossible. ∎
Let , and . If is a cone and is a panel, then and , where .
Since and are adjacent, . By Lemma 5 is starshaped with respect to and , thus . Consequently, . Let and denote the two neighbors of in . Then and .
First suppose that coincides with or , say . Therefore, and . It remains to show that in this case . Let be a neighbor of in . If , then and . By the convexity of , and are adjacent. This implies that . Since , we conclude that . Now suppose that . If , then this would imply that must belong to the cone , a contradiction. This establishes the assertion of the lemma when .
Now suppose that is different from and . This implies that and since , we conclude that . Analogously, since and and are both smaller than , we must have (and ). Thus . Consider the ball of radius around the convex set , which must be convex. Since and , the convexity of implies that . Consequently, we obtain the forbidden induced by the vertices . ∎
defines a partition of . Any fiber is a bridged isometric subgraph of and is starshaped with respect to .
The fact that is a partition follows from its definition. Since any isometric subgraph of a bridged graph is bridged and each fiber is starshaped by Lemma 5, we have to prove that is isometric. Let and be two vertices of . We consider a quasi-median of the triplet . Since is starshaped, the intervals , , , and are all contained in . Consequently, to show that and are connected in by a shortest path, it suffices to show that the unique shortest -path in the deltoid belongs to . To simplify the notations, we can assume two things. First, since , we can let and . Second, we can assume that is a minimal counterexample with . We define this minimality according to two criteria: base length and height. Let be the vertex closest to on the -shortest path of such that . The base length minimality means that we suppose adjacent to (otherwise, we replace by the neighbor of in ). From the structure of deltoids described in Lemma 1, we know that there exists a vertex at distance from , and that . Consider the neighbor of in at distance from . If , then we replace by , where denotes the neighbor of in at distance from . This defines the height minimality. Thus and, if the path between and leaves , then we can also replace by and apply again the base length minimality. By iteratively applying the two criteria while it is possible, we can assume that the deltoid is entirely contained in (see Fig. 5). In particular, . Two cases have to be considered.
Case 1. is a panel. Then, by Lemma 6, belongs to a cone 1-neighboring . Since , . Moreover, by Lemma 7, we also have that and, since , we conclude that . By triangle condition applied to , , and , there exists a vertex at distance from . Since is starshaped and , . This means that . By the convexity of , must coincide with or with (otherwise, the quadruplet would induce a ). By the minimality hypothesis, and must belong to , but then , leading to a contradiction.
Case 2. is a cone. Then belongs to a panel 1-neighboring , and this case is quite similar to the previous one. By Lemma 7, . We thus have and there exists a vertex at distance from . Still using Lemma 7, we deduce that . Since is starshaped, we obtain that , and from the convexity of the ball we conclude that or . Finally, . ∎
If we choose the star centered at a median vertex of , then the number of vertices in each fiber is bounded by (the proof is similar to the proof of [11, Lemma 8]).
If is a median vertex of , then for all , .
6. Boundaries and total boundaries of fibers
Let and be two vertices of . The boundary of with respect to is the set of all vertices of having a neighbor in . The total boundary of is the union of all its boundaries (see Fig. 6).
The total boundary of any fiber is a starshaped tree.
To show that is a starshaped tree, it suffices to show that (1) for every the interval is contained in , and (2) has a unique neighbor in . By Lemma 5, is starshaped, thus is contained in .
First let be a cone. Then has distance to , and and have exactly two common neighbors and . Let be a neighbor of in a fiber 1-neighboring . By Lemma 6, necessarily belongs to a panel or , say . Also, we assume that is a closest to neighbor of in . Let . By the definition of a cone, we have and . This implies that . Since belongs to the panel , . Let be an arbitrary neighbor of in . If , from , , and from the convexity of , we conclude that . This contradicts the choice of . So . Pick any neighbor of in . We assert that . This would imply that and since is -free that has a unique neighbor in . Indeed, and . From the convexity of the ball , we obtain that . This establishes that is a path included in . Notice also that the unique neighbor of in must be adjacent to every neighbor of in because . Indeed, since and , from the convexity of we conclude that .
Now let be a panel and pick any vertex . As in previous case, we have to show that and that has a unique neighbor in . Let be a neighbor of in a fiber 1-neighboring . By Lemma 6, is a cone such that , with and . Assume that is a closest to neighbor of in . Let . By Lemma 7, . If , then we deduce that is adjacent to the neighbor of in , contrary to the choice of . Thus . In that case, if denotes a neighbor of in , then and . From the convexity of , we conclude that . This implies that, if has two neighbors and in , then , , , and induce a forbidden . Consequently, is a path included in . ∎
Let be an arbitrary vertex of . Then, for every pair of vertices of , .
We now describe the structure of metric projections of the vertices on the total boundaries of fibers. Then in Lemma 13 we prove that vertices in panels have a constant number of “exits” on their total boundaries, even if the panel itself may have an arbitrary number of 1-neighboring cones.
Let be a fiber and . Then the metric projection is an induced tree of .
The metric projection of on necessarily belongs to a boundary, that is a starshaped tree by Lemma 10. As a consequence, is a starshaped forest, i.e., a set of starshaped trees. We assert that in fact is a connected subgraph of . To prove this, we will prove the stronger property that is an induced tree of . Assume by way of contradiction that two vertices of are not connected in by a path. First suppose that is an ancestor of in . Then every vertex on the branch of between and belongs to a shortest -path (because is starshaped) and is at distance at most from (because the ball is convex). But then we conclude that the whole shortest -path belongs to , contrary to the choice of . Therefore, further we can suppose that and belong to distinct branches of .
Let be the nearest common ancestor of and in . Let be a quasi-median of , , and . Since is a starshaped tree, , and is the nearest common ancestor of and , we conclude that . We assert that the set of all vertices of between and , between and , and between and belongs to . Indeed, such vertices belong to a shortest -path. The ball is convex and . Since all such vertices also belong to , we conclude that they all have distance from . We