The routing problem is a classic question in distributed graph algorithms [16, 23]. We have a graph and would like to preprocess it for the following task: given a data packet located at some source vertex of , route the packet to a target vertex of , identified by its label. The routing should have the following properties: (A) locality: to determine the next step of the packet, it should use only information at the current vertex or in the packet header; (B) efficiency: the packet should travel along a path whose length is not much larger than the length of a shortest path between and . The ratio between the length of this routing path and a shortest path is called the stretch factor; and (C) compactness: the space requirements for labels, routing tables, and packet headers should be small.
Obviously, we could store at each vertex of the complete shortest path tree of . Then, the routing scheme is perfectly efficient: we can send the packet along a shortest path. However, the scheme lacks compactness. Thus, the challenge is to balance the (seemingly) conflicting goals of compactness and efficiency.
There are many compact routing schemes for general graphs [1, 2, 12, 13, 14, 24, 25]. For example, the scheme by Roditty and Tov  needs to store a poly-logarithmic number of bits in the packet header and it routes a packet from to on a path of length , where is the shortest path distance between and , is any fixed integer, is the number of nodes, and is the number of edges. The routing tables use space. In the late 1980’s, Peleg and Upfal  proved that in general graphs, any routing scheme with constant stretch factor must store bits per vertex, for some constant . Thus, it is natural to focus on special graph classes to obtain better routing schemes. For instance, trees admit routing schemes that always follow the shortest path and that store bits at each node [15, 26, 28]. Moreover, in planar graphs, for any fixed , there is a routing scheme with a poly-logarithmic number of bits in each routing table that always finds a path that is within a factor of from optimal . Similar results are also available for unit disk graphs [19, 30] and for metric spaces with bounded doubling dimension .
Another approach is geometric routing: the graph resides in a geometric space, and the routing algorithm has to determine the next vertex for the packet based on the coordinates of the source and the target vertex, the current vertex, and its neighborhood, see for instance [10, 9] and the references therein. In contrast to compact routing schemes, there are no routing tables, and the routing happens purely based on the local geometric information (and possibly the packet header). For example, the routing algorithm for triangulations by Bose and Morin  uses the line segment between the source and the target for its routing decisions. In a recent result, Bose et al.  show that when vertices do not store any routing tables, no geometric routing scheme can achieve the stretch factor . This lower bound applies irrespective of the header size.
We consider routing in a particularly interesting class of geometric graphs, namely visibility graphs of polygons. Banyassady et al.  presented a routing scheme for polygonal domains with vertices and holes that uses bits for the label, bits for the routing tables, and achieves a stretch of , for any fixed . However, their approach is efficient only if the edges of the visibility graph are weighted with their Euclidean lengths. Banyassady et al. ask whether there is an efficient routing scheme for visibility graphs with unit weights (also called the hop-distance), arguably a more applied setting.
We address this open problem by combining the two approaches of geometric and compact routing: we use routing tables at the vertices to represent information about the structure of the graph, but we also assume that the labels of all adjacent vertices are directly visible at each node. This is reasonable from a practical point of view, because a node in a network must be aware of all its neighbors and their labels. The size of this list is not relevant for the compactness, since it depends purely on the graph and cannot be influenced during preprocessing. We focus our attention on -visibility graphs of orthogonal simple and double histograms. Even this seemingly simple case turns out to be quite challenging and reveals the whole richness of the compact routing problem in unweighted, geometrically defined graphs. Furthermore, histograms constitute a natural starting point, since they are crucial building blocks in many visibility problems; see, for instance, [4, 5, 6, 8, 7, 18]. In addition, -visibility is a popular concept in orthogonal polygons that enjoys many useful structural properties, see, e.g., [22, 18, 21, 17, 29].
A simple histogram is a monotone orthogonal polygon whose upper boundary consists of a single edge; a double histogram is a monotone orthogonal polygon that has a horizontal chord that touches the boundary of only at the left and the right boundary. Let be a (simple or double) histogram with vertices. Two vertices and in are connected in the visibility graph by an unweighted edge if and only if the axis-parallel rectangle spanned by and is contained in the (closed) region (we say that and are co-visible). We present the first efficient and compact routing schemes for polygonal domains under the hop-distance. The following two theorems give the precise statements.
Let be a simple histogram with vertices. There is a routing scheme for with a routing table with 1 bit, without headers, having label size , such that we can route between any two vertices on a shortest path.
Let be a double histogram with vertices. There is a routing scheme for with routing table, label and header size , such that we can route between any two vertices with stretch at most .
Let be an undirected, unweighted, simple, connected graph. The (closed) neighborhood of a vertex , , is the set containing and its adjacent nodes. Let . A sequence of vertices with , for , is called a path of length between and . The length of is denoted by . We define as the length of a shortest path between and , where goes over all paths with endpoints and .
Next, we define a routing scheme. The algorithm that decides the next step of the packet is modeled by a routing function. Every node is assigned a (binary) label that identifies it in the network. The routing function uses local information at the current node, the label of the target node, and the header stored in the packet. The local information of a node has two parts: (i) the link table, a list of the labels of and (ii) the routing table, a bitstring chosen during preprocessing to represent relevant topological properties of . Formally, a routing scheme of a graph consists of:
a label for each node ;
a routing table for each node ; and
a routing function .
The routing function takes the link table and routing table of a current node , the label of a target node , and a header . Using these four inputs, it provides a next node adjacent to and a new header . The local information in the packet is updated to , and it is forwarded to . The routing scheme is correct if the following holds: for any two sites , consider the sequence and , for . Then, there is a with and , for . The routing scheme reaches in steps. Furthermore, is the routing path from to . The routing distance is .
Now, let be a family of correct routing schemes for a given graph class , i.e., contains a correct routing scheme for every graph in such that all routing functions use the same algorithm. There are several measures for the quality of . First, the various pieces of information used for the routing should be small. This is measured by the maximum label size , the maximum routing table size , and the maximum header size , over all graphs in of a certain size. They are defined as
|Finally, the stretch relates the length of the routing path to the shortest path distance:|
Let be a simple orthogonal (axis-aligned) polygon in general position with vertex set , . No three vertices in are on the same vertical or horizontal line. The vertices are indexed counterclockwise from to ; the lexicographically largest vertex has index . For , we write for the -coordinate, for the -coordinate, and for the index.
We consider -visibility: two points see each other (are co-visible) if and only if the axis-aligned rectangle spanned by and lies inside (we treat as a closed set). The visibility graph of has an edge between two vertices if and only if and are co-visible. The distance between two vertices is called the hop distance of and in .
A histogram is an -monotone orthogonal polygon where the upper boundary consists of exactly one horizontal edge, the base edge. Due to our numbering convention, the endpoints of the base edge are indexed (left) and (right). They are called the base vertices. A double histogram is an -monotone orthogonal polygon that has a base line, a horizontal line segment whose relative interior lies in the interior of and whose left and right endpoint are on the left and right boundary edge of , respectively. We assume that the base line lies on the -axis. Two vertices , in lie on the same side if both are below or above the base line, i.e., if . Every histogram is also a double histogram. From now on, we let denote a (double) histogram.
Next, we classify the vertices of. A vertex in is incident to exactly one horizontal edge . We call a left vertex if it is the left endpoint of ; otherwise, is a right vertex. Furthermore, is convex if the interior angle at is ; otherwise, is reflex. Accordingly, every vertex of is either -convex, r-convex, -reflex, or r-reflex.
To understand the structure of shortest paths in , we associate with each three landmark points in (not necessarily vertices); Figure 1 gives an illustration.
The corresponding vertex of , , is the unique vertex that shares a horizontal edge with . To obtain the left point of , we shoot a leftward horizontal ray from . Let be the vertical edge where first hits the boundary of . If is the left boundary of ; then if is a simple histogram, we let be the left base vertex; and otherwise is the point where hits . If is not the left boundary of , we let be the endpoint of closer to the base line. The right point of is defined analogously, by shooting the horizontal ray to the right.
Let and be two points in . We say that is to the left of , if . The point is strictly to the left of , if . The terms to the right of as well as strictly to the right of are defined analogously. The interval of and is the set of vertices in between and , . By general position, this corresponds to index intervals in simple histograms. More precisely, if is a simple histogram and is either an -reflex vertex or the left base vertex and is either -reflex or the right base vertex, then . The interval of a vertex , , is the interval of the left and right point of , . Every vertex visible from is in , i.e., . This interval plays a crucial role in our routing scheme and gives a very powerful characterization of visibility in double histograms.
Let and be two vertices with . We define two more landmarks for and . Assume that lies strictly to the right of , the other case is symmetric. The near dominator of with respect to is the rightmost vertex in to the left of . If there is more than one such vertex, is the vertex closest to the base line. Since is not visible from , the near dominator always exists. The far dominator of with respect to is the leftmost vertex in to the right of . If there is more than one such vertex, is the vertex closest to the base line. If there is no such vertex, we set , the projection of on the right boundary. The interval has all vertices between the near and far dominator; see Figure 2.
3 Simple Histograms
Let be a simple histogram with vertices. First, we give several intuitive characterizations of the visibility in . Then, we analyze how the shortest paths between vertices behave. The idea for our routing scheme is as follows: as long as a target vertex is not contained in the interval of a current vertex , i.e., as long as there is a higher vertex that blocks visibility between and , we have to leave the current pocket as far as possible. Once we have reached a high enough spike, we have to find the pocket containing . Finding the right pocket is possible, but much harder than just going up. Details follow.
3.1 Visibility in Simple Histograms
We begin with some observations on the visibility in . As is a simple histogram, we have that for all vertices , the points and are vertices of . Therefore, the far dominators also have to be vertices. The following observations are now immediate.
Let be -reflex or the left base vertex, and let be a vertex distinct from and . Then, .
Assume or is outside of . Then, has a larger -coordinate than . Thus, cannot see , a contradiction to the definition of . ∎
Let be a left (right) vertex distinct from the base vertex. Then, can see exactly two vertices to its right (left): and ().
Suppose that is a left vertex; the other case is symmetric. Any vertex visible from to the right of lies in in . If is convex, the observation is immediate, since then . Otherwise, is -reflex and . By creftype 3.1, we get that for all , we have . Thus, for any such , and since , cannot see . ∎
3.2 Paths in a Simple Histogram
We now analyze the structure of (shortest) paths in a simple histogram. The following lemma identifies certain “bottleneck” vertices that must appear on any path; see Figure 3.
Let be co-visible vertices such that is either -reflex or the left base vertex and is either -reflex or the right base vertex. Let and be two vertices with and . Then, any path between and includes or .
Let and be two vertices with . If (), then there is a shortest path from to using ().
Assume , the other case is symmetric. Let be a shortest path from to . If contains , we are done. Otherwise, by Lemma 3.3, there is a with and , for . Thus, . Since we assumed , it follows that , so must be to the right of . Therefore, by creftype 3.2, we can conclude that . Now, since is higher than , it can also see and , in particular, it can see . Hence, is a valid path of length at most , so there exists a shortest path from to through . ∎
The next lemma considers the case where is in . Then, the near and far dominator are the potential vertices that lie on a shortest path from to .
Let and be two vertices with . Then, is reflex and either or .
Without loss of generality, lies strictly to the right of . First, assume that is -convex. Since can see and since is to the right of , it follows that and share the same vertical edge. Then, is also visible from and its horizontal distance to is smaller. This contradicts the definition of .
Next, assume that is -convex. Let be the reflex vertex sharing a vertical edge with . Then, and . Furthermore, since is strictly to the right of but still inside , the vertices and must be distinct. Thus, , so that is also visible from . Moreover, the horizontal distance of and is smaller than the horizontal distance of and . This again contradicts the definition of . The first part of the lemma follows.
It remains to show that . First of all, is higher than , since otherwise would not be visible from . Moreover, if and are not co-visible, there must be a vertex strictly between and that is visible from and higher than . Now, either or . In the first case, the horizontal distance between and is smaller than between and , and in the second case, the horizontal distance between and is smaller than between and . Either case leads to a contradiction. Therefore, is higher than , strictly to the right of and visible from . Thus, creftype 3.2 gives . ∎
3.3 The Routing Scheme
We now describe our routing scheme and prove that it gives a shortest path.
Labels and routing tables.
Let be a vertex. If is convex and not a base vertex, it is labeled with its , i.e., . Otherwise, suppose that is an -reflex vertex or the left base vertex. The breakpoint of , , is defined as the left endpoint of the horizontal edge with the highest -coordinate to the right of and below that is visible from ; analogous definitions apply to -reflex vertices and the right base vertex; see Figure 4. Then, the label of consists of the s of and its breakpoint, i.e., . Therefore, . The routing table stores one bit, indicating whether , or not. Hence, .
The routing function.
We are given the current vertex and the label of the target vertex . The routing function does not use any information from the header, i.e., . If is visible from , i.e., if , we directly go from to on a shortest path. Thus, assume that is not visible from . First, we check whether . This is done as follows: we determine the smallest and largest in the link table of . The corresponding vertices are and . Then, we can check whether , which is the case if and only if . Now, there are two cases, illustrated in Figure 5.
First, suppose . If the bit in the routing table of indicates that is higher than , we take the hop to ; otherwise, we take the hop to . By Lemma 3.4, this hop lies on a shortest path from to .
Second, suppose that . This case is a bit more involved. We use the link table of and the label of to determine and . Again, we can do this by comparing the s. Lemma 3.5 states that either or . We discuss the case that , the other case is symmetric. By Lemma 3.3, any shortest path from to includes or . Moreover, due to Lemma 3.5, is reflex, and we can use its label to access . The vertex splits into two disjoint subintervals and . Also, and are not visible from , as they are located strictly between the far and the near dominator. Based on , we can now decide on the next hop.
If , we take the hop to . If , our packet uses a shortest path of length . Thus, assume that lies between and . This is only possible if is -reflex, and we can apply Lemma 3.3 to see that any shortest path from to includes or . But since , our data packet routes along a shortest path.
If , we take the hop to . If , our packet uses a shortest path of length . Thus, assume that lies between and . This is only possible if is -reflex, so we can apply Lemma 3.3 to see that any shortest path from to uses or . Since , our packet routes along a shortest path. The following theorem summarizes our discussion.
Theorem 1 (restated).
Let be a simple histogram with vertices. There is a routing scheme for with a routing table with 1 bit, without headers, having label size , such that we can route between any two vertices on a shortest path.
4 Double Histograms
Let be a double histogram with vertices. Similar to the simple histogram case, we first focus on the visibility and the structure of shortest paths in . Again, if a target vertex is not in the interval of a current vertex , we should widen the interval as fast as possible. However, in contrast to simple histograms, we can now change sides arbitrarily often. Nevertheless, we can guarantee that in each step, the interval comes closer to . Once we have reached the case that is in the interval of the current vertex, we again have to find the right pocket. Unlike in simple histograms, this case is now simpler to describe.
4.1 Visibility in Double Histograms
The structure of the shortest paths in double histograms can be much more involved than in simple histograms; in particular, Lemma 3.3 does not hold anymore. However, the following observations provide some structural insight that can be used for an efficient routing scheme.
Two vertices are co-visible if and only if and .
The forward direction is immediate, since co-visibility implies and . For the backward direction, let be the rectangle spanned by and . Since and , the upper and lower boundary of do not contain a point outside . As is a double histogram, this implies that the left and right boundary of also do not contain any point outside . The claim follows since has no holes. ∎
Let , , , and be vertices in with . If and , then and are co-visible.
This follows immediately from creftype 4.1. ∎
The intervals on one side of form a laminar family, i.e., for any two vertices and on the same side of the base line, we have (i) , (ii) , or (iii) .
Suppose there are two vertices and on the same side of with . By creftype 4.2, and are co-visible. Since and are on the same side of , either cannot see any vertex to the left of or cannot see any vertex to the right of . This contradicts the fact that the and as well as and must be co-visible. ∎
4.2 Paths in a Double Histogram
To understand shortest paths in double histograms, we distinguish three cases, depending on where lies relative to . First, if is close, i.e., if , we focus on the near and far dominators. Second, if but there is a vertex visible from with , then we can find a vertex on a shortest path from to . Third, if there is no visible vertex from such that , we can apply our intuition from simple histograms: go as fast as possible towards the base line. Details follow.
The target is close.
Let be two vertices with . In contrast to simple histograms, now might not be a vertex. Furthermore, and might be on different sides of the base line. In this case, Lemma 3.5 no longer holds. However, the next lemma establishes a visibility relation between them; see Figure 6.
Let with . Then, and are co-visible.
Without loss of generality, is strictly to the right of . Suppose for a contradiction that is strictly left of . Then, we get . Also, . Hence, by creftype 4.1, can see . But then is a vertex strictly between the near and far dominator visible from , contradicting the choice of the dominators. Thus, , and creftype 4.2 gives the result. ∎
The proof of the next lemma uses Lemma 4.4 to find a shortest path vertex.
One of or is on a shortest path from to . If is not a vertex, then is on a shortest path from to .
Without loss of generality, is to the right of . Let be a shortest path from to , and let be the last vertex outside of . If , then must be one of the dominators, since by definition they are the only vertices in visible from . Now, assume . If is to the left of , we apply Lemma 4.4 and creftype 4.2 on the four points , , , and to conclude that can see . Symmetrically, if is to the right of , the same argument shows that the far dominator can see . Thus, depending on the position of we can exchange the subpath in by or and get a valid path of length . The second part of the lemma holds because cannot be to the right of , if is not a vertex but a point on the right boundary. ∎
Next, we consider the case where is a vertex but not on a shortest path from to . Then, cannot see , and we define . By Lemma 4.4, and are co-visible, so has to be in the interval , and therefore it is a vertex. The following lemma states that is strictly closer to than ; see Figure 7.
If is a vertex but not on a shortest path from to , then we have .
Without loss of generality, is to the right of . By Lemma 4.5, lies on a shortest path from to . Let be such a shortest path. We claim that can see . Then, is a valid path of length . To prove that can indeed see , we show that and and then apply creftype 4.1.
First, we show by contradiction. Thus, suppose . Since , there is a with and . First, if , then . By Lemma 4.4, and are co-visible, so creftype 4.2 implies that and are co-visible. Then is a valid path of length , contradicting the assumption that is not on a shortest path. If , it follows with the same reasoning that and are co-visible then is on which is a valid path of length . This again contradicts the assumption.
Now, since , we get . Since sees which is to the left of and since is in , and thus to the right of , it follows that . ∎
The target can be made close in one step.
Let be two vertices with but there is a vertex with . For clarity of presentation, we will always assume that is below the base line. The crux of this case is this: there might be many vertices visible from that have in their interval. However, we can find a best vertex as follows: once is in the interval of a vertex, the goal is to shrink the interval as fast as possible. Therefore, we must find a vertex whose left or right interval boundary is closest to among all vertices in . This leads to the following inductive definition of two sequences and of vertices in . For , we let . For , if the set is nonempty, we define ; and , otherwise. If the set is nonempty, we define ; and , otherwise. We force unambiguity by choosing the vertex closer to the base line. Let be the vertex with , for an , and the vertex with , for an . If the context is clear, we write instead of and instead of .
Let us try to understand this definition. For , we write for ; and we write for . Then, we have and . Now, if is not a vertex, then , because there is no vertex whose left point is strictly to the left of the left boundary of . On the other hand, if is a vertex in , we have , and is an interval between points on the lower side of . Then comes a (possibly empty) sequence of intervals between points on the upper side of ; possibly followed by the interval . There are four possibilities for : it could be , , a vertex on the upper side of , or . If , then the intervals are strictly increasing: is strictly to the left of and is strictly to the right of ; see Figure 8. Symmetric observations apply for the ; we write for and for .
For , the vertices and as well as and are co-visible.
We focus on and . We show that and ; the lemma follows from creftype 4.1. The claim is due to the facts that and (this holds also for , as then ). Next, since , the vertex is to the left of ; and since , the point is to the left of . Thus, if is visible from , we have , by the definition of . On the other hand, if is not visible from , the visibility must be blocked by , and then . In either case, we have , as desired. ∎
Finally, the next lemma tells us the following: if we find a vertex with . Its quite technical proof needs Lemma 4.7.
If , for some , then is on a shortest path from to . If , for some , then is on a shortest path from to .
We focus on the first statement; see Figure 9. Let be a shortest path from to , and let be the last vertex on outside of . If , then must be , because this is the only vertex visible from . Then, and is on . From now on, we assume that .
First, suppose that and are co-visible. Then is a path from to that uses and has length . Second, suppose that