Extending Partial Representations of Proper and Unit Interval Graphs111The conference version of this paper appeared in SWAT 2014 kkorssv (). The first, second and sixth authors are supported by ESF Eurogiga project GraDR as GAČR GIG/11/E023, the first author also by GAČR 14-14179S and the first two authors by Charles University as GAUK 196213. The fourth author is supported by a fellowship within the Postdoc-Program of the German Academic Exchange Service (DAAD), the sixth author by projects NEXLIZ - CZ.1.07/2.3.00/30.0038, which is co-financed by the European Social Fund and the state budget of the Czech Republic, and ESF EuroGIGA project ComPoSe as F.R.S.-FNRS - EUROGIGA NR 13604.
The recently introduced problem of extending partial interval representations asks, for an interval graph with some intervals pre-drawn by the input, whether the partial representation can be extended to a representation of the entire graph. In this paper, we give a linear-time algorithm for extending proper interval representations and an almost quadratic-time algorithm for extending unit interval representations.
We also introduce the more general problem of bounded representations of unit interval graphs, where the input constrains the positions of some intervals by lower and upper bounds. We show that this problem is NP-complete for disconnected input graphs and give a polynomial-time algorithm for the special class of instances, where the ordering of the connected components of the input graph along the real line is prescribed. This includes the case of partial representation extension.
The hardness result sharply contrasts the recent polynomial-time algorithm for bounded representations of proper interval graphs [Balko et al. ISAAC’13]. So unless , proper and unit interval representations have vastly different structure. This explains why partial representation extension problems for these different types of representations require substantially different techniques.
keywords:intersection representation, partial representation extension, bounded representations, restricted representation, proper interval graph, unit interval graph, linear programming
Geometric intersection graphs, and in particular intersection graphs of objects in the plane, have gained a lot of interest for their practical motivations, algorithmic applications, and interesting theoretical properties. Undoubtedly the oldest and the most studied among them are interval graphs (INT), i.e., intersection graphs of intervals on the real line. They were introduced by Hájos hajos_interval_graphs () in the 1950’s and the first polynomial-time recognition algorithm appeared already in the early 1960’s gilmore64 (). Several linear-time algorithms are known, see PQ_trees (); LBFS_int (). The popularity of this class of graphs is probably best documented by the fact that Web of Knowledge registers over 300 papers with the words “interval graph” in the title. For useful overviews of interval graphs and other intersection-defined classes, see textbooks agt (); egr ().
Only recently, the following natural generalization of the recognition problem has been considered kkv (). The input of the partial representation extension problem consists of a graph and a part of the representation and it asks whether it is possible to extend this partial representation to a representation of the entire graph. Klavík et al. kkv () give a quadratic-time algorithm for the class of interval graphs and a cubic-time algorithm for the class of proper interval graphs. Two different linear-time algorithms are given for interval graphs blas_rutter (); kkosv (). There are also polynomial-time algorithms for function and permutation graphs kkkw () as well as for circle graphs cfk (). Chordal graph representations as intersection graphs of subtrees of a tree kkos () and intersection representations of planar graphs int_planar_hard () are mostly hard to extend.
A related line of research is the complex of simultaneous representation problems, pioneered by Jampani and Lubiw simultaneous_interval_graphs (); jl-srpcc-12 (), where one seeks representations of two (or more) input graphs such that vertices shared by the input graphs are represented identically in each of the representations. Although in some cases the problem of finding simultaneous representations generalizes the partial representation extension problem, e.g., for interval graphs blas_rutter (), this connection does not hold for all graph classes. For example, extending a partial representation of a chordal graph is NP-complete kkos (), whereas the corresponding simultaneous representation problem is polynomial-time solvable jl-srpcc-12 (). While a similar reduction as the one from blas_rutter () works for proper interval graphs, we are not aware of a direct relation between the corresponding problems for unit interval graphs.
In this paper, we extend the line of research on partial representation extension problems by studying the corresponding problems for proper interval graphs (PROPER INT) and unit interval graphs (UNIT INT). Roberts’ Theorem proper_is_unit () states . It turns out that specific properties of unit interval representations were never investigated since it is easier to work with combinatorially equivalent proper interval representations. It is already noted in kkv () that partial representation extension behaves differently for these two classes; see Figure 1a. This is due to the fact that for proper interval graphs, in whose representations no interval is a proper subset of another interval, the extension problem is essentially topological and can be treated in a purely combinatorial manner. On the other hand, unit interval representations, where all intervals have length one, are inherently geometric, and the corresponding algorithms have to take geometric constraints into account.
It has been observed in other contexts that geometric problems are sometimes more difficult than the corresponding topological problems. For example, the partial drawing extension of planar graphs is linear-time solvable angelini () for topological drawing but NP-hard for straight-line drawings patrignani (). Together with Balko et al. bko (), our results show that a generalization of partial representation extension exhibits this behavior already in 1-dimensional geometry. The bounded representation problem is polynomial-time solvable for proper interval graphs bko () and NP-complete for unit interval graphs. From a perspective of representations, this result separates proper and unit interval graphs. We show that, unless , the structure of all proper interval representations is significantly different from the structure of all unit interval representations; see Figure 1b.
Next, we formally introduce the problems we study and describe our results.
1.1 Classes and Problems in Consideration
For a graph , an intersection representation is a collection of sets such that if and only if ; so the edges of are encoded by the intersections of the sets. An intersection-defined class is the class of all graphs having intersecting representations with some specific type of sets . For example, in an interval representation each is a closed interval of the real line. A graph is an interval graph if it has an interval representation.
Studied Classes. We consider two classes of graphs. An interval representation is called proper if no interval is a proper subset of another interval (meaning implies ). An interval representation is called unit if the length of each interval is one. The class of proper interval graphs (PROPER INT) consists of all interval graphs having proper interval representations, whereas the class of unit interval graphs (UNIT INT) consists of all interval graphs having unit interval representations. Clearly, every unit interval representation is also a proper interval representation.
In an interval representation , we denote the left and right endpoint of the interval by and , respectively. For numbered vertices , we denote these endpoints by and . Note that several intervals may share an endpoint in a representation. When we work with multiple representations, we use and for them. Their intervals are denoted by and .
Studied Problems. The recognition problem of a class asks whether an input graph belongs to ; that is, whether it has a representation by the specific type of sets . We study two generalizations of this problem: The partial representation extension problem, introduced in kkv (), and a new problem called the bounded representation problem.
A partial representation of is a representation of an induced subgraph of . A vertex in is called pre-drawn. A representation extends if for each .
Suppose, that we are given two rational numbers and for each vertex . A representation is called a bounded representation if .
It is easy to see that BoundRep generalizes since we can just put for all pre-drawn vertices, and , for the remaining vertices.
The bounded representation problem can be considered also for interval graphs and proper interval graphs, where the left and right endpoints of the intervals can be restricted individually. A recent paper of Balko et al. bko () proves that this problem is polynomially solvable for these classes. Note that for unit intervals, it suffices to restrict the left endpoint since . The complexity for other classes, e.g. circle graphs, circular-arc graphs, permutation graphs, is open.
1.2 Contribution and Outline.
In this paper we present five results. The first is a simple linear-time algorithm for RepExt(PROPER INT), improving over a previous -time algorithm kkv (); it is based on known characterizations, and we present it in Section 3.
can be solved in time .
We note that this algorithm needs some minor and very natural assumption on the encoding of the input; see Conclusions for details.
Second, in Section 4, we give a reduction from 3-Partition to show that BoundRep is NP-complete for disconnected graphs. The main idea is that prescribed intervals partition the real line into gaps of a fixed width. Integers are encoded in connected components whose unit interval representations require a certain width. By suitably choosing the lower and upper bounds, we enforce that the connected components have to be placed inside the gaps such that they do not overlap.
BoundRep is NP-complete.
Third, in Section 5.1, we give a relatively simple quadratic-time algorithm for the special case of BoundRep where the order of the connected components along the real line is fixed. We formulate this problem as a sequence of linear programs, and we show that each linear program reduces to a shortest-path problem which we solve with the Bellmann-Ford algorithm.
The running time is , where is the total encoding length of the bounds in the input, and is the time required for multiplying or dividing two numbers whose binary representation has length . This is due to the fact that the numbers specifying the upper and lower bounds for the intervals can be quite close to each other, requiring that the corresponding rationals have an encoding that is super-polynomial in . Clearly, two binary numbers whose representations have length can be added in time, explaining the term of in the running time. However, using Bellmann-Ford for solving the LP requires also the comparison of rational numbers. To be able to do this efficiently, we convert the rational numbers to a common denominator. Hence, the multiplication cost enters the running time. The best known algorithm achieves division ().
BoundRep with a prescribed ordering of the connected components can be solved in time , where is the size of the input describing bound constraints.
Our algorithm is based on shifting intervals. It starts with some initial representation and creates, by a series of transformations, the so-called left-most representation of the input graph. The algorithm performs combinatorial iterations, each taking time . The additional time is used for arithmetic operations with the bounds. The main idea for reducing the running time with respect to the previous approach is to work with short approximations of the involved rational numbers. We compute the precise position of intervals only once, when they reach their final position.
Further, we derive in Sections 4.1, 5.2, and 5.4 many structural results concerning unit interval representations. In particular, we show that all representation of one connected component form a semilattice. We believe that these results might be useful in designing a faster algorithm, attacking other problems, and getting overall better understanding of unit interval representations.
If the number of connected components is small, we can test all possible orderings .
For connected components, BoundRep can be solved in time.
Finally, we note that every instance of RepExt(UNIT INT) is an instance of BoundRep. In Section 6, we show how to derive for these special instances a suitable ordering of the connected components, resulting in an efficient algorithm for RepExt(UNIT INT).
can be solved in time , where is the size of the input describing positions of pre-drawn intervals.
All the algorithms described in this paper are also able to certify the extendibility by constructing the required representations.
2 Notation, Preliminaries and Structure
As usual, we reserve for the number of vertices and for the number of edges of the graph . We denote the set of vertices by and the set of edges by . For a vertex , we denote the closed neighborhood of by . We also reserve for the size of the input describing either bound constraints (for the BoundRep problem) or positions of pre-drawn intervals (for ). This value is for the entire graph , and we use it even when we deal with a single component of . We reserve for the number of components of (maximal connected subgraphs of ).
(Un)located Components. Unlike the recognition problem, RepExt cannot generally be solved independently for connected components. A connected component of is located if it contains at least one pre-drawn interval and unlocated if it contains no pre-drawn interval.
Let be any interval representation. Then for each component , the union is a connected segment of the real line, and for different components we get disjoint segments. These segments are ordered from left to right, which gives a linear ordering of the components. So we have components ordered .
Structure. The main goal of this paper is to establish Theorem 1.3 and to apply it to solve . Since this paper contains several other results, the structure might not be completely clear. Now, we try to sketch the story of this paper.
In Section 3, we describe a key structural lemma of Deng et al. deng (). Using this lemma, we give a simple characterization of extendible instances of , which yields the linear-time algorithm of Theorem 1.1. Also, the reader gets more familiar with the basic difficulties we need to deal with in the case of unit interval graphs.
In Section 4, we show two results for the BoundRep problem. First, we give a polynomial bound on the required resolution of the drawing. So there exists a value , which is polynomial in the size of the input, such that there exists a representation where, for every , the positions and belong to the -grid . Using this, the required representation can be constructed in this -grid. Also, we show that the BoundRep problem is in general NP-complete, which proves Theorem 1.2.
Section 5 is the main section of this paper and it deals with the BoundRep problem with a prescribed ordering of the components. First, we describe an LP-based algorithm for solving this problem that solves linear programs. Then we derive some structural results concerning the partially ordered set of all -grid unit interval representations. Using this structure, we conclude the section with a fast combinatorial algorithm for the above linear programs, solving the BoundRep problem in time .
In Section 6, we show using the main theorem that can be solved in time . In Conclusions, we deal with the related problem of simultaneous representations and give some open problems.
3 Extending Proper Interval Representations
In this section, we describe how to extend partial representations of proper interval graphs in time . We also give a simple characterization of all extendible instances.
Indistinguishable Vertices. Vertices and are called indistinguishable if . The vertices of can be partitioned into groups of (pairwise) indistinguishable vertices. Note that indistinguishable vertices may be represented by the same intervals (and this is actually true for general intersection representations). Since indistinguishable vertices are not very interesting from the structural point of view, if the structure of the pre-drawn vertices allows it, we want to prune the graph to keep only one vertex per group.
Suppose that we are given an instance of . We compute the groups of indistinguishable vertices in time using the algorithm of Rose et al. recog_chordal_graphs (). Let and be two indistinguishable vertices. If is not pre-drawn, or both vertices are pre-drawn with , then we remove from the graph, and in the final constructed representation (if it exists) we put . For the rest of the section, we shall assume that the input graph and partial representation are pruned. An important property is that for any representation of a pruned graph, it holds that all intervals are pairwise distinct. So if two intervals are pre-drawn in the same position and the corresponding vertices are not indistinguishable, then we stop the algorithm because the partial representation is clearly not extendible.
Left-to-right ordering. Roberts roberts_phd_thesis () gave the following characterization of proper interval graphs:
Lemma 3.1 (Roberts)
A graph is a proper interval graph if and only if there exists a linear ordering of its vertices such that the closed neighborhood of every vertex is consecutive.
This linear order corresponds to the left-to-right order of the intervals on the real line in some proper interval representation of the graph. In each representation, the order of the left endpoints is exactly the same as the order of the right endpoints, and this order satisfies the condition of Lemma 3.1. For an example of , see Figure 2.
How many different orderings can a proper interval graph admit? In the case of a general unpruned graph possibly many, but all of them have a very simple structure. In Figure 2, the graph contains two groups and . The vertices of each group have to appear consecutively in the ordering and may be reordered arbitrarily. Deng et al. deng () proved the following:
Lemma 3.2 (Deng et al.)
For a connected (unpruned) proper interval graph, the ordering satisfying the condition of Lemma 3.1 is uniquely determined up to local reordering of groups of indistinguishable vertices and complete reversal.
This lemma is key for partial representation extension of proper interval graphs. Essentially, we just have to deal with a unique ordering (and its reversal) and match the partial representation on it. Notice that in a pruned graph, if two vertices are indistinguishable, then their order is prescribed by the partial representation.
We want to construct a partial ordering which is a simple representation of all orderings from Lemma 3.1. There exists a proper interval representation with an ordering if and only if extends either or its reversal. According to Lemma 3.2, can be constructed by taking an arbitrary ordering and making indistinguishable vertices incomparable. For the graph in Figure 2, we get
where groups of indistinguishable vertices are put in brackets. This ordering is unique up to reversal and can be constructed in time uint_corneil ().
Characterization of Extendible Instances. We give a simple characterization of the partial representation instances that are extendible. We start with connected instances. Let be a pruned proper interval graph and be a partial representation of its induced subgraph . Then intervals in are in some left-to-right ordering . (Recall that the pre-drawn intervals are pairwise distinct.)
The partial representation of a connected graph is extendible if and only if there exists a linear ordering of such that:
The ordering extends , and either or its reversal.
Let and be two pre-drawn touching intervals, i.e., , and let be any vertex distinct from and . If , then , and if , then .
If there exists a representation extending , then it is in some left-to-right ordering . Clearly, the pre-drawn intervals are placed the same, so has to extend . According to Lemma 3.2, extends or its reversal. As for (2), clearly has to be the right-most neighbor of in : If is on the right of , it would not intersect . Similarly, is the left-most neighbor of .
Conversely, let be an ordering from the statement of the lemma. We construct a representation extending as follows. We compute a common linear ordering of the left and right endpoints from left-to-right.222Notice that, in the partial representation, some intervals may share position. But if two endpoints and share the position, then and we break the tie by setting . We start with the ordering , into which we insert the right endpoints one-by-one. For vertex , let be its right-most neighbor in the ordering . Then, we place right before (if , otherwise we append to the end of the ordering).
This left-to-right common order is uniquely determined by . Since extends , it is compatible with the partial representation (the pre-drawn endpoints are ordered as in ). To construct the representation, we just place the non-pre-drawn endpoints equidistantly into the gaps between neighboring pre-drawn endpoints (or to the left or right of ). It is important that, if two pre-drawn endpoints and share their position, then according to condition (2) there is no endpoint placed in between of and in (otherwise one of the two implications would not hold, depending whether a left endpoint is intersected in between, or a right one). See Figure 3 for an example.
We argue correctness of the constructed representation . First, it extends , since the pre-drawn intervals are not modified. Second, it is a correct interval representation: Let and be two vertices with , and let be the right-most neighbor of in . If , then and, by consecutivity of in , we have . Therefore, and intersect. If and , then , so and do not intersect. If and , then and and do not intersect. Finally, we argue that is a proper interval representation. In the order of the left endpoints is the same as the order of the right-endpoints, since is always placed on the right of in .
We conclude that the representation can be made small enough to fit into any open segment of the real line that contains all pre-drawn intervals.∎
Now, we are ready to characterize general solvable instances.
A partial representation of a graph is extendible if and only if
for each component , the partial representation consisting of the pre-drawn intervals in is extendible, and
pre-drawn vertices of each component are consecutive in .
The necessity of (1) is clear. For (2), if some component would not have its pre-drawn vertices consecutive in , then would not be a connected segment of the real line (contradicting existence of from Preliminaries).
Now, if the instance satisfies both conditions we can construct a correct representation extending as follows. Using (2), the located components are ordered from left to right, and we assign pairwise disjoint open segments containing all their pre-drawn intervals (there is a non-empty gap between located components we can use). To unlocated components, we assign pairwise disjoint open segments to the right of the right-most located component. See Figure 4. For each component, we construct a representation in its open segment, using the construction in the proof of Lemma 3.3.∎
We are ready to prove that can be solved in time :
[Theorem 1.1] We just use the characterization by Lemma 3.4, of which the conditions (1) and (2) can be easily checked in time . For Lemma 3.3, we check for each component both constraints (1) and (2). To check (2), we compute for and its reversal the unique orderings . We test for each of them whether each touching pair of pre-drawn intervals is placed in according to (2).
4 Bounded Representations of Unit Interval Graphs
In this section, we deal with bounded representations. An input of BoundRep consists of a graph and, for each vertex , a lower bound and an upper bound . (We allow and .) The problem asks whether there exists a unit interval representation of such that for each interval . Such a representation is called a bounded representation.
Since unit interval representations are proper interval representations, all properties of proper interval representations described in Section 3 hold, in particular the properties of orderings and .
4.1 Representations in -grids
Endpoints of intervals can be positioned at arbitrary real numbers. For the purpose of the algorithm, we want to work with representations drawn in limited resolution. For a given instance of the bounded representation problem, we want to find a lower bound for the required resolution such that this instance is solvable if and only if it is solvable in this limited resolution.
More precisely, we want to represent all intervals so that their endpoints correspond to points on some grid. For a value , where is an integer, the -grid is the set of points .333If was not of the form , then the grid could not contain both left and right endpoints of the intervals. We reserve for the value in this paper. For a given instance of BoundRep, we ask which value of ensures that we can construct a representation having all endpoints on the -grid. So the value of is the resolution of the drawing.
If there are no bounds, every unit interval graph has a representation in the grid of size uint_corneil (). In the case of BoundRep, the size of the grid has to depend on the values of the bounds. Consider all values and distinct from , and express them as irreducible fractions . Then we define:
where denotes the least common multiple of . It is important that the size of this written in binary is . We show that the -grid is sufficient to construct a bounded representation:
If there exists a bounded representation for an input of the problem BoundRep, there exists a bounded representation in which all intervals have endpoints on the -grid, where is defined by (1).
We construct an -grid representation from in two steps. First, we shift intervals to the left, and then we shift intervals slightly back to the right. For every interval , the sizes of the left and right shifts are denoted by and respectively. The shifting process is shown in Figure 5.
In the first step, we consider the -grid and shift all the intervals to the left to the closest grid-point (we do not shift an interval if its endpoints are already on the grid). Original intersections are kept by this shifting, since if and are two endpoints satisfying before the left-shift, then also holds after the left-shift. So if and before the shift, then these inequalities are preserved by the shifting. On the other hand, we may introduce additional intersections by shifting two non-intersecting intervals to each other. In this case, after the left-shift, the intervals only touch; for an example, see vertices and in Figure 5.
The second step shifts the intervals to the right in the refined -grid to remove the additional intersections created by the first step. The right-shift is a mapping
having the right-shift property: For all pairs with , if and only if . So the right-shift property ensures that RS fixes wrongly represented touching pairs created by LS.
To construct such a mapping RS, notice that if we relax the image of RS to , the reversal of LS would have the right-shift property, since it produces the original correct representation . But the right-shift property depends only on the relative order of the shifts and not on the precise values. Therefore, we can construct RS from the reversal of LS by keeping the shifts in the same relative order. If is one of the th smallest shifts, we set .444In other words, for the smallest shifts we assign the right-shift ; for the second smallest shifts, we assign ; for the third smallest shifts, ; and so on. See Figure 5.
We finally argue that these shifts produce a correct -grid representation. The right-shift does not create additional intersections: After LS non-intersecting pairs are at distance at least , and by RS they can get closer by at most . Also, if after LS two intervals overlap by at least , their intersection is not removed by RS. The only intersections which are modified by RS are touching pairs of intervals having after LS. The mapping RS shifts these pairs correctly according to the edges of the graph.
Next we look at the bound constraints. If, before the shifting, was satisfying , then this is also satisfied after since the -grid contains the value . Obviously, the inequality is not broken after . As for the upper bound, if and , then the bound is trivially satisfied. Otherwise, after we have , so the upper bound still holds after .∎
Additionally, Lemma 4.1 shows that it is always possible to construct an -grid representation having the same topology as the original representation, in the sense that overlapping pairs of intervals keep overlapping, and touching pairs of intervals keep touching. Also notice that both representations and have the same order of the intervals.
In the standard unit interval graph representation problem, no bounds on the positions of the intervals are given, and we get and . Lemma 4.1 proves in a particularly clean way that the grid of size is sufficient to construct unrestricted representations of unit interval graphs. Corneil et al. uint_corneil () show how to construct this representation directly from the ordering , whereas we use some given representation to construct an -grid representation.
4.2 Hardness of BoundRep
In this subsection we focus on hardness of bounded representations of unit interval graphs. We prove Theorem 1.2 stating that BoundRep is NP-complete.
We reduce the problem from 3-Partition. An input of 3-Partition consists of natural numbers , , and such that for all , and . The question is whether it is possible to partition the numbers into triples such that each triple sums to exactly . This problem is known to be strongly NP-complete (even if all numbers have polynomial sizes) partition ().
[Theorem 1.2] According to Lemma 4.1, if there exists a representation satisfying the bound constraints, then there also exists an -grid representation with this property. Since the length of given by (1), written in binary, is polynomial in the size of the input, all endpoints can be placed in polynomially-long positions. Thus we can guess the bounded representation and the problem belongs to NP.
Let us next prove that the problem is NP-hard. For a given input of 3-Partition, we construct the following unit interval graph . For each number , we add a path (of length ) into as a separate component. For all vertices in these paths, we set bounds
In addition, we add independent vertices , and make their positions in the representation fixed:
See Figure 6 for an illustration of the reduction. Clearly, the reduction is polynomial.
We now argue that the bounded representation problem is solvable if and only if the given input of 3-Partition is solvable. Suppose first that the bounded representation problem admits a solution. There are gaps between the fixed intervals each of which has space less than . (The length of the gap is but the endpoints are taken by and .) The bounds of the paths force their representations to be inside these gaps, and each path lives in exactly one gap. Hence the representation induces a partition of the paths.
Now, the path needs space at least in every representation since it has an independent set of the size . The representations of the paths may not overlap and the space in each gap is less than , hence the sum of all ’s in each part is at most . Since the total sum of ’s is exactly , the sum in each part has to be . Thus the obtained partition solves the 3-Partition problem.
Conversely, every solution of 3-Partition can be realized in this way.∎
5 Bounded Representations of Unit Interval Graphs with Prescribed Ordering
In this section, we deal with the BoundRep problem when a fixed ordering of the components is prescribed. First we solve the problem using linear programming. Then we describe additional structure of bounded representations, and using this structure we construct an almost quadratic-time algorithm that solves the linear programs.
5.1 LP Approach for BoundRep
According to Lemma 3.2, each component of can be represented in at most two different ways, up to local reordering of groups of indistinguishable vertices. Unlike the case of proper interval graphs, we cannot arbitrarily choose one of the orderings, since neighboring components restrict each other’s space. For example, only one of the two orderings for the component in Figure 7 makes a representation of possible.
In the algorithm, we process components from left to right and construct representations for them. When we process a component , we want to represent it on the right of the previous component , and we want to push the representation of as far to the left as possible, leaving as much space for as possible.
Now, we describe in details, how we process a component . We calculate by the algorithm of Corneil et al. the partial ordering described in Section 3 and its reversal. The elements that are incomparable by these partial orderings are vertices of the same group of indistinguishable vertices. For these vertices, the following holds:
Suppose there exists some bounded representation . Then there exists a bounded representation such that, for every indistinguishable pair and satisfying , it holds that .
Given a representation , we call a pair bad if and are indistinguishable, and . We describe a process which iteratively constructs from , by constructing a sequence of representations , where the positions in a representation are denoted by ’s.
In each step , we create from by fixing one bad pair : we set and the rest of the representation remains the same. Since and are indistinguishable and is correct, the obtained is a representation. Regarding bound constraints,
so the bounds of are satisfied.
Now, in each the set of all left endpoints is a subset of the set of all left endpoints of . In each step, we move one left-endpoint to the left, so each endpoint is moved at most times. Hence the process terminates after iterations and produces a representation without bad pairs as requested.∎
For and its reversal, we use Lemma 5.1 to construct linear orderings : If and belong to the same group of indistinguishable vertices and , then . If , we choose any order between and .
We obtain two total orderings , and we solve a linear program for each of them. Let be one of these orderings. We denote the right-most endpoint of a representation of a component by . Additionally, we define . Let be defined as in (1). We modify all lower bounds by putting for every interval , which forces the representation of to be on the right of the previously constructed representation of . The linear program has variables , and it minimizes the value of . We solve:
We solve the same linear program for the other ordering of the vertices of . If none of the two programs is feasible, we report that no bounded representation exists. If exactly one of them is feasible, we keep the values obtained for and , and process the next component . If the two problems are feasible, we keep the solution in which the value of is smaller, and process .
Constraints of types (3) and (4) are satisfied, since the representation is bounded and on the right of . Constraints of type (5) correspond to a correct representation of intersecting pairs of intervals. The non-intersecting pairs of an -grid representation are at distance at least , which makes constraints of type (6) satisfied.∎
Now, we are ready to show:
The BoundRep problem with prescribed can be solved in polynomial time.
Concerning the running time, it depends polynomially on the sizes of and , which are polynomial in the size of the input . It remains to show correctness.
Suppose that the algorithm returns a candidate for a bounded representation. The formulation of the linear program ensures that it is a correct representation: Constraints of type (2) make the representation respect . Constraints of type (3) and (4) enforce that the given lower and upper bounds for the positions of the intervals are satisfied, force the prescribed ordering on the representation of , and force the drawings of the distinct components to be disjoint. Finally, constraints of type (2), (5) and (6) make the drawing of the vertices of a particular component to be a correct representation.
Suppose next that a bounded representation exists. According to Lemma 4.1 and Lemma 5.1, there also exists an -grid bounded representation having the order in the indistinguishable groups as defined above. So for each component , one of the two orderings constructed for the linear programs agrees with the left-to-right order of in .
We want to show that the representation of each component in gives a solution to one of the two linear programs associated to . We denote by the value of in the representation , and by the value of obtained by the algorithm after solving the two linear programming problems associated to . We show by induction on that , which specifically implies that exists and at least one of the linear programs for is solvable.
We start with . As argued above, the left-to-right order in agrees with one of the orderings , so the representation of satisfies the constraints (2). Since , the lower bounds are not modified. By Lemma 5.2, the rest of the constraints are also satisfied. Thus the representation of gives a feasible solution for the program and gives .
Assume now that, for some with , at least one of the two linear programming problems associated to admits a solution, and from induction hypothesis we have . In , two neighboring components are represented at distance at least . Therefore for every vertex of , it holds , so the modification of the lower bound constraints is satisfied by . Similarly as above using Lemma 5.2, the representation of in satisfies the remaining constraints. It gives some solution to one of the programs and we get .
In summary, if there exists a bounded representation, for each component at least one of the two linear programming problems associated to admits a solution. Therefore, the algorithm returns a correct bounded representation (as discussed in the beginning of the proof). We note that does not have to be an -grid representation since the linear program just states that non-intersecting intervals are at distance at least . To construct an -grid representation if necessary, we can proceed as in the proof of Lemma 4.1.∎
We note that it is possible to reduce the number of constraints of the linear program from to , since neighbors of each appear according to Lemma 3.1 consecutively in . Using the ordering constraints (2), we can replace constraints (5) and (6) by a linear number of constraints as follows. For each , there are two cases. If is adjacent to all vertices such that , then we only state the constraint (5) for and . Otherwise, let be the rightmost vertex such that and . Then we only state the constraint (5) for and , and the constraint (6) for and . This is equivalent to the original formulation of the problem.
In general, any linear program can be solved in time by using Karmarkar’s algorithm KarmarkarLP (). However, our linear program is special which allows to use faster techniques:
The BoundRep problem with prescribed can be solved in time .
Without loss of generality, we assume that the upper and lower bounds restrict the final representation (if it exists) to lie in the interval . For a given , let be the index such that is the rightmost neighbor of in . Let be the index such that is the rightmost vertex such that and . (Notice that might not be defined, in which case we ignore inequalities containing it.)
We replace the variables by such that . We want to solve the following linear system:
The obtained linear program is a system of difference constraints, since each inequality has the form .
Following (introalgo, , Chapter 24.4), if the system is feasible, a solution, which is not necessarily optimal, can be found as follows. We define a weighted digraph as follows. As the vertices, we have where corresponds to and is a special vertex. For the edges , we first have an edge of the weight zero for every . Then for every constraint , we add the edge of the weight . See Figure 8.
As proved in (introalgo, , Chapter 24.4), there are two possible cases. If contains a negative-weight cycle, then there is no feasible solution for the system. If does not contain negative-weight cycles, then we define as the weight of the minimum-weight path connecting to in . Then we put for each which defines a feasible solution of the system. Moreover, this solution minimizes the objective function . We next show that this function is equivalent to the objective function in our linear program.
Suppose that we have a solution of our system, satisfying the constraints but not necessarily optimizing the objective function. Because of our assumption that the representation lies in the interval , we know that for all . Therefore, . So is always attained by , while is always attained by . So minimization of the objective function is equivalent to the original minimization of .
In order to find a negative-weight cycle in or, alternatively, compute the weight of the minimum-weight paths from to all the other vertices of , we use the Bellman-Ford algorithm. Notice that Dijkstra’s algorithm cannot be used in this case, since some edges of have negative weight. We next analyze the running time of the whole procedure.
We assume that the cost of arithmetic operations with large numbers is not constant. The algorithm computes the value in the beginning which can be clearly done in time . (Instead of the least common multiple we can simply compute the product of ’s.)
Afterwards, we compute the weights of the edges of as multiples of , which takes time . Then each step of the Bellman-Ford algorithm requires time , and the algorithm runs steps in total. The total time to solve each linear program is therefore . Finally, the total time of the algorithm is .∎
In the next subsections, we improve the time complexity of the BoundRep problem with prescribed to . Our algorithm makes use of several structural properties of the set of all representations. We note that structural properties of the polyhedron of our linear program, in the case where all lower bounds equal zero and there are no upper bounds, have been considered in several papers in the context of semiorders semiorder_minimal_rep (); semiorder_polytopes ().
5.2 The Partially Ordered Set
Let the graph in consideration be a connected unit interval graph. We study structural properties of its representations. Suppose that we fix one of the two partial left-to-right orders of the intervals from Section 3, so that only indistinguishable vertices are incomparable. We also fix some positive . For most of this section, we work just with lower bounds and completely ignore upper bounds.
We define as the set of all -grid representations satisfying the lower bounds and in some left-to-right ordering that extends . We define a very natural partial ordering on : We say that if and only if for every ; i.e., is the carthesian ordering of vectors . In this section, we study structural properties of the poset .
If , then . The reason is that the graph is a unit interval graph, and thus there always exists an -grid representation far to the right satisfying the lower bound contraints.
The Semilattice Structure. Let us assume that for some . Let be a subset of . The infimum is the greatest representation such that for every . In a general poset, infimums may not exist, but if they exist, they are always unique. For , we show:
Every non-empty has an infimum .
We construct the requested infimum as follows:
Notice that the positions in are well-defined, since the position of each interval in each is bounded and always on the -grid. Clearly, if is a correct representation, it is the infimum . It remains to show that .
Clearly, all positions in belong to the -grid and satisfy the lower bound constraints. Let and be two vertices. The values and in are given by two representations , that is, and . Notice that the left-to-right order in has to extend : If , then , since minimizes the position of and the left-to-right order in extends . Concerning correctness of the representation of the pair and , we suppose that ; otherwise we swap and .
First we suppose that . Then , since minimizes the position of . Since is a correct representation, . So , and the intervals and intersect.
The other case is when . Then , since minimizes the position of , is a correct representation and in both representations. So and do not intersect in as requested.
Consequently, represents correctly each pair and , and hence .∎
A poset is a (meet)-semilattice if every pair of elements has an infimum . Lemma 5.5 shows that the poset forms a (meet)-semilattice. Similarly as , we could consider the poset set of all (-grid) representations satisfying both the lower and the upper bounds. The structure of this poset is a complete lattice, since all subsets have infimums and supremums. Lattices and semilattices are frequently studied, and posets that are lattices satisfy very strong algebraic properties.
The Left-most Representation. We are interested in a specific representation in , called the left-most representation. An -grid representation is the left-most representation if for every ; so the left-most representation is left-most in each interval at the same time. We note that the notion of the left-most representation does not make sense if we consider general representations (not on the -grid). The left-most representation is the infimum , and thus by Lemma 5.5 we get:
The left-most representation always exists and it is unique.
There are two algorithmic motivations for studying left-most representations. First, in the linear program of Section 5.1 we need to find a representation minimizing . Clearly, the left-most representation is minimizing and in addition it is minimizing the rest of the endpoints as well. The second motivation is that we want to construct a representation satisfying the upper bounds as well, so it seems reasonable to try to place every interval as far to the left as possible. The left-most representation is indeed a good candidate for a bounded representation:
There exists a representation satisfying both lower and upper bound constraints if and only if the left-most representation satisfies the upper bound constraints.
Since , it satisfies the lower bounds. If satisfies the upper bound constraints, it is a bounded representation. On the other hand, let be a bounded representation. Then
and the left-most representation is also a bounded representation.∎
5.3 Why Left-most Representations Cannot Be Easily Constructed by Iterations?
A very natural idea for an algorithm is to construct the left-most representation iteratively, by adding the vertices one by one and recomputing the left-most representation in each step. In this section, we describe why this natural algorithm does not run in quadratic time. More precisely, we do not claim that it is not possible to implement it in quadratic time or faster using some additional tricks and structural results, but we did not succeeded in this matter.
The Iterative Algorithm. Let be a connected unit interval graph, and let be the left-to-right partial ordering of its vertices numbered from left to right. We denote by the graph induced by . Let be the left-most representation of , and let