1 Introduction
Map labelling is a wellknown problem in cartography with applications in educational diagrams, system manuals and scientific visualization. Traditional map labelling that places the labels on the map such that each label is incident to its corresponding feature, creates overlap between labels if the features are densely located on the map. This motivated the use of leaders [15, 9]: line segments that connect features to their labels. As a formal investigation of this approach, Bekos et al. [3] introduced boundary labelling: all the labels are required to be placed on the boundary of the map and to be connected to their features using leaders. The point where a leader touches the label is called a port. Their work initiated a line of research in developing labelling algorithms with different labelling aesthetics, such as minimizing leader crossings, number of bends per leader and sum of leader lengths [1, 2, 4, 5].
In this paper, we study the bend sided boundary labelling problem. The input is an axisaligned rectangle and a set of points (called sites) in the interior of . In addition, the input contains a set of points on the boundary of representing the ports on consecutive sides of for some . The objective is to decide whether each site can be connected to a unique port using an axisaligned leader with at most bend such that the leaders are disjoint and each leader lies entirely in the interior of , except the endpoint that is attached to a port. Figure 1(a) illustrates a labelling for a 1bend sided boundary labelling instance. If such a solution exists, then we call it a feasible solution and say that the problem is solvable. Notice that not every instance of the boundary labelling problem is solvable; see Figure 1(b).
Related work.
The boundary labelling problem was first formulated by Bekos et al. [3] who solved the 1bend onesided and 1bend twosided models (when the ports lie on two opposite sides of ) in time. They also gave an time algorithm for the 2bend foursided boundary labelling problem (i.e., when each leader can have at most 2 bends).
Kindermann et al. [11] examined sided boundary labelling, where the ports appear on adjacent sides. For the 1bend twosided boundary labelling problem, they gave an time algorithm. For 1bend three and foursided models of the problem, they gave  and time algorithms, respectively. If a boundary labelling instance admits an affirmative solution, then it is desirable to seek for a labelling that optimizes a labelling aesthetic, such as minimizing the sum of the leader lengths or minimizing the number of bends per leader. For minimizing the sum of leader lengths, Bekos et al. [3] gave an exact time algorithm for the 1bend onesided and 1bend (opposite) twosided models; their algorithm for 1bend onesided model was later improved to an time algorithm by Benkert et al. [4].
Kindermann et al. [11] gave an time dynamic programming algorithm for the 1bend (adjacent) twosided model. Bose et al. [5] (see [6] for the full version) improved this result by giving an time dynamic programming algorithm. They also showed that the 1bend three and foursided problems (for the sum of the leader length minimization) can be reduced to the maximum independent set problem on outerstring graphs. The idea is to, for each site, obtain leaders by connecting the site to every port. Consider each leader as an outerstring (i.e., a polygonal curve that has one endpoint attached to the boundary of an enclosing rectangle). This forms an outerstring graph. Then, by an appropriate weight assignment for edges, the boundary labelling problem is equivalent to the maximumweight independent set problem on this outerstring graph. Since we have outerstrings (where is the number of sites) and maximumweight independent set can be solved in time on outerstring graphs (here, is the complexity of geometrically representing the input graph) [10], they obtain an time algorithm for the three and foursided boundary labelling problem. However, it is not obvious whether this approach can be used to obtain a faster algorithm for the decision version, where we do not require leader length minimization.
Other models for boundary labelling such as labelling with sliding ports [4], dynamic boundary labelling [14], boundary labelling with octilinear leaders [2], manytoone boundary labelling [13, 12] and boundary labelling in the presence of obstacles [8] has also been studied. Moreover, see [4, 5] for results on bend minimization. Throughout the paper, we consider 1bend leaders, which are also known as leaders [3].
Our results.
In this paper, we give algorithms with running times and for the 1bend threesided and foursided boundary labelling problems, which improves the previously best known algorithms by nearly a linear factor.
The fastest known algorithm for the threesided model was Kindermann et al.’s [11] time algorithm that reduced the problem into twosided boundary labelling problems. While we also use their partitioning technique, our improvement comes from a dynamic programming approach that carefully decomposes threesided problems into various simple shapes that are not necessarily rectangular. We prove that such a decomposition can be computed fast using suitable datastructures. The crux of our approach is to show new properties of simpler types of problems and then using them as building blocks to solve the main labelling problem.
For the foursided model, the fastest known algorithm was the time algorithm of Bose et al. [5] that reduced the problem into the maximum independent set problem in an outerstring graph. We show that Kindermann et al.’s [11] observation on partitioning twosided boundary labelling problems using a monotone curve can be used to find a fast solution for the foursided model. Such an approach was previously taken by Bose et al. [5], but it already took time for the 2sided model, and they eventually settled with an time algorithm for the foursided model. With the four sides involved, designing a decomposition with a few different types of shapes of low complexity becomes challenging. Our improvement results from a systematic decomposition that generates a small number of subproblems at the expense of using a larger size dynamic programming table, resulting in an time algorithm.
2 Preliminaries
In this section, we give some notation and preliminaries that will be used in the rest of the paper. For a point in the plane, we denote the  and coordinates of by and , respectively. Consider the input rectangle and let denote the corners of that are named in clockwise order such that is the topright corner of . Let and denote the top, bottom, left and right sides of , respectively. We refer to a port as a top port (resp., bottom, left and right port), if it lies on (resp., and ). Similarly, we call a leader a top leader (resp., bottom, left and right leader), if it is connected to a top port (resp., bottom, left and right port).
Let be the number of ports on the top, right, bottom and left side of ; notice that . We denote these ports as and in clockwise order. See Figure 1(a) for an example. We assume that the sites are in general position; i.e., the number of sites and ports on every horizontal (similarly, vertical) line that properly intersects is at most one. For the rest of the paper, whenever we say a rectangle, we mean an axisaligned rectangle.
For a point inside , consider the rectangle that is spanned by and , where . Each rectangle contains only two types of ports; e.g., contains only top and right ports. A feasible solution for a solvable instance of a boundary labelling problem is called partitioned, if there exists a point such that for each rectangle , there exists an axisaligned monotone polygonal curve from to that separates the two types of leaders in . That is, every pair of sites in that lie on different sides of are connected to ports that lie on different (but adjacent) sides of . See Figure 1(c). We refer to the polygonal curve as the separating curve. Kindermann et al. [11] observed that if an instance of a boundary labelling problem admits a feasible solution, then it must admit a partitioned solution.
Lemma 2.1 (Kindermann et al. [11]).
If there exists a feasible solution for the 1bend foursided boundary labelling problem, then there also exists a partitioned solution for the problem.
Consider a twosided problem where the ports are on and . Assume that the problem has a feasible solution, and let be an separating curve. Let (resp., ) be the polygonal regions above (resp., below ) that is bounded by and (resp., by and ). Now, let (resp., ) be the separating curve that minimizes the area of (resp., ). Given and , we construct a sequence of rectangles as follows (see Figure 1(d)).

Each rectangle is a maximal rectangle between and .

The bottomleft corner of is . Since is maximal, it is uniquely determined.

Let . We know that the top and right sides of are determined by a pair of leaders and , respectively. Let be the rightmost point on the top side of , and let be the topmost point on the right side of . Then the rectangle is the maximal empty rectangle whose bottomleft corner is and that is bounded by and .
We say that an instance of the problem is balanced if it contains the same number of sites and ports. We next show the following result that will be useful in the following sections.
Lemma 2.2.
Let be a 1bend onesided boundary labelling problem with a constraint that the leftmost and rightmost ports on must be connected to a pair of points , respectively. Let be the rightmost or bottommost site of the problem excluding and . If has a feasible solution satisfying the given constraint, then it also has a solution with connects to the first port (while walking from to along the boundary) that decomposes the problem into two balanced subproblems.
Proof.
First, assume that is the bottommost point (see Figure 2(a)–(b)). Assume for a contradiction that connecting to would not give a feasible solution, whereas there is another port such that connecting to would yield a feasible solution.
Note that lies to the left of . Let be the leader of . We swap the leaders of and . Such a swap may introduce crossings in the rectangular region to the right side of . However, after the swap both sides of the leader of in are balanced onesided problems (see Figure 2(c)). Such a solution with crossings to a 1sided boundary labelling problem can always be made planar by local swaps [4]. The proof for the case when is the rightmost point is the same. Figure 2(e)–(h) illustrate such a scenario. ∎
3 ThreeSided Boundary Labelling
In this section, we give an time algorithm for the threesided boundary labelling problem. We assume that the ports are located on and . Kindermann et al. [11] gave an time algorithm for this problem as follows. Consider the grid induced by a horizontal and a vertical line through every port and site. For each node of this grid, they partition the threesided problem into an shaped twosided and a shaped twosided problem (Figure 3(a)–(b)). They showed that the threesided problem is solvable if and only if there exists a grid node whose two twosided problems both are solvable.
3.1 Algorithm Overview
We also start by considering every grid node , but we employ a dynamic programming approach that expresses the resulting twosided subproblems by and a port. We show that the twosided subproblems can have different types. This gives us different tables, each of size . We show that the running time to fill all the entries is . For a grid node , let be the projection of onto . The point splits the ports on into two sets: those to the left of and those to the right of it. This means that the line segment can be extended to an axisaligned curve with two bends that splits the problem into two balanced  and shaped twosided subproblems; see Figure 3. Kindermann et al. [11] observed that such a balanced partition is unique. Hence if there exists a balanced partition by extending to a 2bend curve, then there must be a unique position where the number of sites to the left of the curve matches the number of ports to the left of .
In the following, we describe the details of solving the  and shaped twosided problems. W.l.o.g., we assume that the twosided problem contains the topleft corner of . While decomposing an shaped problem, we will reduce it either into a smaller shaped problem or a rectangular twosided problem. Decomposition of shaped problem is more involved.
3.2 Solving an Shaped Problem
We denote an shaped subproblem with a grid node and a port , where lies either on or . If is a port on (i.e., for some ), then we denote the subproblem by in which the bottom side is determined by a horizontal line through (e.g., see Figure 3(c)). Here, the last parameter denotes whether the port belongs to or . Initially, we assume a dummy port located at and so our goal is to compute . On the other hand, if for some (i.e., it is a port on ), then we define the problem as (see Figure 3(d))). Here, the goal is to compute , where is a dummy port at .
To decompose , we find the rightmost site of the subproblem in time (Figure 4(a)). We first do some preprocessing, and then consider two cases depending on whether lies to the left or right side of the vertical line through .
For the preprocessing, we keep the sites and ports in a range counting data structure that supports counting query [7]. Second, for each horizontal slab determined by a pair of horizontal grid lines (passing through sites and ports), we keep the points inside the slab in a sorted array , which takes time. We now use these data structures to find . We first compute the sites and ports in the rectangle determined by the diagonal , and then find the number of points needed in time. Finally, we find a site (that balances the number of sites and points) in time by a binary search in the array for the slab determined by the horizontal grid lines through and . If lies to the right of the vertical line through , then is the desired point . Otherwise, lies to the left of the vertical line through , and we can find by searching in the array for the slab determined by the horizontal grid lines through and . We will frequently search for such a unique site throughout the paper and so we will use a similar preprocessing.
Case 1 ( lies to the right side of the vertical line through ).
We connect to the “right” port: after connecting, the resulting subproblems are balanced; i.e., the number of sites in each resulting subproblem is the same as the number of ports of that subproblem. There might be several ports that are right in this sense, but one can apply Lemma 2.2 (assuming dummy leaders as boundary constraints) to show that the subproblem has a feasible solution if and only if there exists a feasible solution connecting either to the bottommost or to the rightmost port that satisfies the balanced condition. Once we find and the appropriate port for , there are three possible scenarios as illustrated in Figure 4. We can decompose the subproblem using the following recursive formula (depending on whether is connected to or ):
Here, is an shaped onesided problem and is a rectangular onesided problem. There always exists a solution for the balanced rectangular onesided problem [4], and thus can be considered as true. Since is balanced, we can show that there always exists a solution for , as follows. First assume that the vertical line through does not pass through a port (see Figure 5(a)). Let be the rightmost port in , and let be the set of points inside the rectangle determined by diagonal . Scale down the rectangle horizontally and translate the rectangle inside the vertical slab determined by the vertical lines through and . There always exists a solution for the balanced rectangular onesided problem [4], we can translate the points back to their original position extending the leaders as necessary. The case when the vertical line through passes through a port can be processed in the same way, by first connecting to the topmost point of , and then choosing the port immediately to the left of as . We thus have the following recurrence formula.
We now show how to find the point and then decompose . The table is of size . We will show that each subproblem can be solved by a constant number of table lookups, and these entries can be found in time. Hence, the overall computation takes time.
We now show how to find the “right” port for . First, assume that is a port on (see Figure 4(a)–(b)). We need another time preprocessing as follows. Define a table , where is a site, and is a port on . At the entry , we store the port such that is the smallest index for which the rectangle defined by , the horizontal lines through and the vertical line through contains exactly sites. We set to 0 when no such port exists. The table has size and we can fill each entry of the table in time; hence, we can fill out the entire in time. Observe that the port for is stored in .
Consider now the case when is a port on (see Figure 4(c)). We again rely on an time preprocessing. For every site and a vertical grid line (passing through a port or a site) to the left of , we keep a sorted array of size . Each element of the array corresponds to a rectangle bounded by the horizontal line through , , and another vertical grid line through a port to the left of . The rectangles are sorted based on the difference between the sites and ports and then by the coordinate of . Consequently, to find , we can look for the number of sites in the rectangle determined by the diagonal (see Figure 5(b)), and then binary search for that number in the precomputed array for .
Case 2 ( lies to the left side of the vertical line through ).
Let be the intersection of the vertical line through and the leader connecting and (see Figure 5(c)). Since is the rightmost point, it suffices to solve the rectangular twosided problem determined by the rectangle with diagonal (shown in falling pattern). We will determine whether a solution exists in time based on some precomputed information, as follows.
For each vertical grid line, we will precompute the topmost horizontal grid line such that the twosided problem (shown in orange) determined by these lines, and has a feasible solution. If lies above , then the twosided problem is solvable (as the remaining region determines a balanced onesided problem); otherwise, it is not solvable. We will use the known time algorithm [11] to check the feasibility of a twosided problem, which looks for a “partitioned” solution. However, we do not necessarily require our twosided problem to be partitioned.
We now show that the precomputation takes time. For every vertical grid line , we first compute a sorted array of horizontal grid lines such that the twosided problem determined by and each element of is balanced. This takes time for and time for all vertical grid lines. For each , we then do a binary search on to find the topmost grid line such that the corresponding twosided problem has a feasible solution. Since computing a solution to the twosided problem takes time [11], can be found in time for , and in time for all the vertical grid lines.
Remark.
While decomposing shapes, we always find the rightmost point . If the coordinate of is larger than that of , then the subproblems and are also shaped. Otherwise, the problem reduces to a rectangular onesided or twosided problem. Hence a shape problem does not appear during the decomposition of shaped problems.
3.3 Solving a Shaped Problem
Consider the shaped problem containing the topleft corner ; see e.g. Figure 6(a). Let be the projection of onto , and let be the other bend of the shape. In the following, we refer to the rectangle with diagonal as the forbidden region.
Kindermann et al. [11, Lemma 8] observed that there must exist an axisaligned monotone curve that connects to such that the sites above are connected to top ports and the sites below are connected to left ports. We extend to along the vertical line (e.g., see Figure 6(b)). Since no leader will enter the forbidden region, we can now consider as a separating curve for a twosided problem determined by the rectangle with diagonal . For any partitioned solution, we can compute a sequence of maximal empty rectangles, as we discussed in Section 2, such that the lowerright corner of coincides with . To decompose the problem, consider the first rectangle in this sequence. The rectangle can either cover the forbidden region entirely or partially in three different ways; see Figure 6(b). Since the separating curve through the grid point (Figure 6(a)) determines a partition, the leaders of the shape must not enter into the forbidden region. Therefore, it suffices to consider an empty rectangle that entirely covers the forbidden region.
Since is maximal, the top or left side of must contain a site (e.g., see Figure 6(c)); because otherwise, the leaders that determines the top and left side of will cross. Assume w.l.o.g. that the top side of contains a site that is connected to a port . Notice that cannot be a left port because it contradicts the existence of the curve . Moreover, the left side of either contains a site or it is aligned with a leader that connects a port to a site . The bottom row in Figure 6 shows all possible scenarios; notice that cannot be connected to a top port, again because of having . This decomposes the problem into three subproblems (see Figure 6(d)). Two onesided subproblems and , and a smaller twosided subproblem. is bounded by the leader connecting to , the left side of , and . The subproblem is bounded by the leader connecting to , , the curve determined by , and the top side of .
The smaller twosided subproblem is bounded by , the leaders incident to and , and the boundary of . We solve such twosided problems by finding a sequence of maximal empty rectangles as described in Section 2. The idea is inspired by Bose et al.’s [5] approach to solve a twosided problem using a compact encoding for the table. Since we do not optimize the sum of leader lengths, our approach is much simpler.
Decomposing twosided subproblems.
To decompose the twosided subproblems, we use the following observation.
Lemma 3.1 (Bose et al. [5]).
If a twosided boundary labelling problem with sites on and has a feasible solution, then there exists a partitioned solution where every maximal empty rectangle contains a site either on its top or on its left side.
We first describe how to represent the twosided problems. If the maximal empty rectangle contains a site on its top side (Figure 6(g)), then we represent the problem with the ports and the coordinate of the left side of , i.e., and coordinate of . Otherwise, we use the ports and the coordinate of the top side of .
Formally, define a table (resp., ), where and are two ports and denotes the coordinate (resp., coordinate) of the site to which the port (resp., ) is connected (see Figure 7). Given (similarly, ), we can completely determine the problem boundary, as follows. Note that by definition the left side of (the rectangle that defined the subproblem, shown in pink) has the coordinate . Hence the site of lies on the top side of (by Lemma 3.1). We can thus perform a binary search to find this site. Once we have the two sites (and so the two incident leaders), we can find the lower right corner for the next candidate rectangle as defined in Section 2.
We now show how to compute ; the other is symmetric. After we determine the lower right corner for the next subsequent rectangle, we look for all candidate maximal empty rectangles with lower right corner . Consider now one such candidate rectangle (shown in orange in Figure 7), and let and be the ports defining its left and top sides, respectively. This now decomposes into three subproblems; namely, two onesided subproblems defined by and , and a twosided subproblem. By Lemma 3.1, contains a site on its top or left side. If the top side of contains a site, then we lookup the entry ; otherwise, we lookup the entry . We hence have the following recurrence relation.
Here, and are onesided problems, bounded by two leaders and a maximum empty rectangle. In the following, we discuss how to solve these problems.
Solving onesided problems.
If , where , is a balanced rectangular onesided problem (Figure 8(d)–(e)), then it has a feasible solution [4]. If is shaped and bounded by one side of the maximum empty rectangle (Figure 8(f)), then it can be reduced to a rectangular onesided problem, as described in Section 3.2. Otherwise, the boundary of contains two sides of the maximal empty rectangle (Figure 8(a)–(b)), or one side of the maximal empty rectangle and two vertical segments of the two leaders (Figure 8(c)). In such a case, we can decide whether it has a feasible solution in time, as follows.
Let be the bottomleft corner of the empty rectangle and the bend point of the leader of (Figure 8(a)–(c)), respectively. Let be the number of sites in the open rectangle determined by the diagonal . Let be a port such that there are ports between and (including ). If the coordinate of is not larger than that of (or , if is below ), then we can decompose the problem into two subproblems such that both of them have a feasible solution. One of these subproblems is a rectangular onesided problem (shown in pink), and the other is an shaped onesided problem (shown in green). Both of them are balanced. The existence of a solution is immediate from [4] for the rectangular case. The existence of a solution for the shaped case is by the reduction to a onesided rectangular problem (Section 3.2). If the coordinate of is larger than that of (or that of , if is below ), then there does not exist a solution with leaders not intersecting the empty rectangle (or the leader of ).
Note that the table and are of size and each subproblem can be solved by examining a set of candidate rectangles. Bose et al. [5] observed that the number of such candidate rectangles is , and while searching for candidate rectangles, no rectangle appears more than once. Thus the total number of table look ups is bounded by . Furthermore, all these rectangles can be precomputed in time [5]. Hence, the overall time to solve a shaped problem is . The following theorem summarizes the result of this section.
Theorem 3.1.
Given a 1bend threesided boundary labelling problem with sites and ports, one can find a feasible solution (if exists) in time.
4 FourSided Boundary Labelling
In this section, we give an time dynamic programming algorithm for the foursided boundary labelling.
4.1 Algorithm Overview
Our dynamic programming solution will search for a set of maximal empty rectangles corresponding to the separating curve, as described in Section 2. The intuition is to represent a problem using at most two given leaders. For example, in Figure 9(a) the first empty rectangle is , with the top and right sides of determined by the leaders of and , respectively. The problem will have a feasible solution with these given leaders if and only if the subproblems and (shown in falling and rising patterns, respectively) have feasible solutions. Since the subproblems must be balanced, given the two leaders adjacent to (see Figure 9(a)), we can determine the boundary of the problem. We will use this idea to encode the subproblems.
It may initially appear that to precisely describe a subproblem, one should need some additional information along with the two given leaders. For example, the dashed boundary in Figure 9(b). However, such information can be derived from the given leaders. Here, the topright corner of (hence, the dashed line) can be recovered using the coordinate of the bottommost point of the leader of , and the coordinate of the leftmost point of the leader of . We will try all possible choices for the first empty rectangle . In a general step, we will continue searching for the subsequent empty rectangle. For example, consider the subproblem in Figure 9(b). For a subsequent empty rectangle, we will decompose the problem into at most three new subproblems (Figure 9(c)). Each of these new subproblems can be represented using at most two leaders.
4.2 Solving Subproblems
We will distinguish the subproblems depending on whether they contain the topright corner of the rectangle or not. We first outline the case when a subproblem contains .
A subproblem contains .
We denote a subproblem that contains by . Here, are the two ports on the opposite sides of the separating curve, and and are their corresponding sites. Given , we can completely determine the boundary of the subproblem, as follows. Let and be a pair of points on the leaders of and , respectively, with the minimum Euclidean distance. Then, the rectangle with diagonal determines the boundary of the subproblem. Figure 10 illustrates the cases (up to the horizontal or vertical reflection of the sites), where the maximal empty rectangle contains a site on its top side. The recovered boundary is shown in red. On the other hand, Figure 11 illustrates the cases when does not contain any site on its top or right side. If there are several choices for , then we take the one with the smallest coordinate (or, symmetrically smallest coordinate) as illustrated in Figure 11(d).
We now show how to decompose subproblems containing . Since we are searching for a partitioned solution, the decomposition must contain at least one such subproblem. Let be the empty rectangle associated with (Figure 12(a)). First assume the case when is on and is on . Let be the pair of points with the minimum Euclidean distance between the leaders of and . Let be the rectangle with diagonal . Note that we can choose the bottom left corner of as the bottom left corner of the subsequent empty rectangle . There are choices for the topright corner of . Thus trying all these subproblems would take time to fill the table entry corresponding to .
Instead of searching for directly, we first extend vertically (Figure 12(b)) and then horizontally (Figure 12(c)). Thus the subsequent rectangle in our approach will have choices for the top boundary. The leader that determines the top boundary will partition the problem into two subproblems: one is a problem that includes , and the other problem is either a onesided or a twosided subproblem depending on the position of . For example, in Figure 12(b), .
Note that sometimes can be extended only in one direction. For example, in Figure 12(c), we have , and is a vertical line bounded by the leaders, as shown in red. In this case we extend horizontally and we have choices for its right boundary. The leader that determines the right boundary (i.e, the one connecting to ) will partition the problem into two subproblems: one is a problem that includes , and the other problem is either a onesided or a twosided subproblem depending on the position of . For example, in Figure 12(c), .
A subproblem excludes .
We first show that these problems must be either onesided or twosided. Let be the subproblem that includes . Let be a subproblem that excludes and lies above the separating curve. Then the only available sides of for are and . Symmetrically, only and are available for . If (where ) is a onesided problem, then we can process the problem in the same ways as described in Section 3.
Consider now the case of twosided problems, and assume w.l.o.g. that is a twosided problem. Note that contains the topleft corner of . Since we are searching for a partitioned solution (recall Lemma 2.1), there must be a monotone axisaligned separating curve connecting the bottomright and the topleft corners of . Hence, there must exist a sequence of empty rectangles associated with it. Therefore, we can continue decomposing the problem in the same way as we did for the problems that include .
4.3 Time Complexity
We maintain the points and ports in an orthogonal range counting data structure (with time preprocessing) such that given an axisaligned rectangle, one can report the number of ports and points interior to the rectangle in time [7].
The encoding of the form allows us to use a dynamic programming table of size . Computing each entry requires examining candidates for an empty rectangle. Each candidate rectangle divides the problem into at most two new subproblems. If the new subproblems are not balanced, then the candidate rectangle would not give a feasible solution. Otherwise, the new subproblems are balanced. For the twosided problems we perform table lookup, while the feasibility of the onesided problems can be decided in time. Once we complete the dynamic programming, we get a set of ports mapped to sites and a set of onesided problems that are feasible, for which the solution needs to be constructed. Since there can be such onesided problems, and each can be solved in time (either by the algorithm of [4], or by a reduction to the rectangular onesided case), the total time required is .
We can use the range counting data structure to check whether a subproblem is balanced in time [7]. We can precompute the candidate rectangles for every grid point in time. Since each table lookup takes time, filling an entry of the dynamic programming table would take time for all the candidate rectangles corresponding to that entry. Hence, the overall running time of the algorithm is . The following theorem summarizes the main result of this section.
Theorem 4.1.
Given a 1bend foursided boundary labelling problem with sites and ports, one can find a feasible labelling (if exists) in time.
5 Conclusion
In this paper, we gave algorithms with running times and for the 1bend three and foursided boundary labelling problems, improving the previous algorithms of Kindermann et al. [11] and Bose et al. [5]. The main direction for future work is to improve the running time of our algorithms. Another direction is to study the finegrained complexity of the problem; e.g., can we find a nontrivial lower bound on the running time? Even a quadratic lower bound is not known. Note that Bose et al.’s algorithm [5] minimizes the sum of leader lengths, but ours do not. It would also be interesting to seek faster algorithms that minimize the sum of leader lengths.
References
 [1] Michael A. Bekos, Sabine Cornelsen, Martin Fink, SeokHee Hong, Michael Kaufmann, Martin Nöllenburg, Ignaz Rutter, and Antonios Symvonis. Manytoone boundary labeling with backbones. J. Graph Algorithms Appl., 19(3):779–816, 2015.
 [2] Michael A. Bekos, Michael Kaufmann, Martin Nöllenburg, and Antonios Symvonis. Boundary labeling with octilinear leaders. Algorithmica, 57(3):436–461, 2010.
 [3] Michael A. Bekos, Michael Kaufmann, Antonios Symvonis, and Alexander Wolff. Boundary labeling: Models and efficient algorithms for rectangular maps. Comput. Geom., 36(3):215–236, 2007.
 [4] Marc Benkert, Herman J. Haverkort, Moritz Kroll, and Martin Nöllenburg. Algorithms for multicriteria boundary labeling. J. Graph Algorithms Appl., 13(3):289–317, 2009.
 [5] Prosenjit Bose, Paz Carmi, J. Mark Keil, Saeed Mehrabi, and Debajyoti Mondal. Boundary labeling for rectangular diagrams. In 16th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT 2018), June 1820, 2018, Malmö, Sweden, pages 12:1–12:14, 2018.
 [6] Prosenjit Bose, Paz Carmi, J. Mark Keil, Saeed Mehrabi, and Debajyoti Mondal. Boundary labeling for rectangular diagrams. CoRR, abs/1803.10812, 2018.
 [7] Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars. Computational Geometry: Algorithms and Applications. Springer, Berlin Heidelberg, 2008.
 [8] Martin Fink and Subhash Suri. Boundary labeling with obstacles. In Proceedings of the 28th Canadian Conference on Computational Geometry (CCCG), pages 86–92, 2016.
 [9] Herbert Freeman and Sean Marrinan amd Hitesh Chitalia. Automated labeling of soil survey maps. In ASPRSACSM Annual Convention, Baltimore, volume 1, pages 51–59, 1996.
 [10] J. Mark Keil, Joseph S. B. Mitchell, Dinabandhu Pradhan, and Martin Vatshelle. An algorithm for the maximum weight independent set problem on outerstring graphs. Comput. Geom., 60:19–25, 2017.
 [11] Philipp Kindermann, Benjamin Niedermann, Ignaz Rutter, Marcus Schaefer, André Schulz, and Alexander Wolff. Multisided boundary labeling. Algorithmica, 76(1):225–258, 2016.
 [12] ChunCheng Lin. Crossingfree manytoone boundary labeling with hyperleaders. In IEEE Pacific Visualization Symposium PacificVis 2010, Taipei, Taiwan, March 25, 2010, pages 185–192, 2010.
 [13] ChunCheng Lin, HaoJen Kao, and HsuChun Yen. Manytoone boundary labeling. J. Graph Algorithms Appl., 12(3):319–356, 2008.
 [14] Martin Nöllenburg, Valentin Polishchuk, and Mikko Sysikaski. Dynamic onesided boundary labeling. In 18th ACM SIGSPATIAL International Symposium on Advances in Geographic Information Systems (GIS), pages 310–319, 2010.
 [15] Steven Zoraster. Practical results using simulated annealing for point feature label placement. Cartography and GIS, 24(4):228–238, 1997.
Comments
There are no comments yet.