Fully Dynamic Data Structures for Interval Coloring

04/01/2019 ∙ by Girish Raguvir J, et al. ∙ Indian Institute Of Technology, Madras 0

We consider the dynamic graph coloring problem restricted to the class of interval graphs. At each update step the algorithm is presented with an interval to be colored, or a previously colored interval to delete. The goal of the algorithm is to efficiently maintain a proper coloring of the intervals with as few colors as possible by an online algorithm. In the incremental model, each update step presents the algorithm with an interval to be colored. The problem is closely connected to the online vertex coloring problem of interval graphs for which the Kierstead-Trotter (KT) algorithm achieves the best possible competitive ratio. We first show that a sub-quadratic time direct implementation of the KT-algorithm is unlikely to exist conditioned on the correctness of the Online Boolean Matrix Vector multiplication conjecture due to Henzinger et al. DBLP:conf/stoc/HenzingerKNS15. We then design an incremental algorithm that is subtly different from the KT-algorithm and uses at most 3 ω - 2 colors, where ω is the maximum clique in the interval graph associated with the set of intervals. Our incremental data structure maintains a proper coloring in amortized O( n + Δ) update time where n is the total number of intervals inserted and Δ is the maximum degree of a vertex in the interval graph. We then consider the fully dynamic framework involving insertions and deletions. On each update, our aim is to maintain a 3 ω - 2 coloring of the remaining set of intervals, where ω is the maximum clique in the interval graph associated with the remaining set of intervals. Our fully dynamic algorithm supports insertion of an interval in O( n + Δω) worst case update time and deletion of an interval in O(Δ^2 n) worst case update time.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

The graph coloring problem is an extensively studied problem. Similarly, maintenance of data structures for dynamic graphs has been extensively studied. The dynamic graph coloring problem is as follows : There is an online update sequence of insertion or deletion of edges or vertices and the goal is to maintain proper coloring after every update. Several works ([DBLP:conf/COSSOM/DutotGOP],[DBLP:conf/CCCA/OuerfelliB],[DBLP:SallinenIPGRP] and [DBLP:conf/HardyLT]

) propose heuristic and experimental results on the dynamic graph coloring problem. To the best of our knowledge, the only formal analysis of data structures for dynamic graph coloring are

[DBLP:conf/esa/SolomonW18_coloring], [DBLP:conf/soda/BhattacharyaCHN18], [DBLP:conf/iccS/BarenboimM17], and [DBLP:conf/wads/BarbaCKLRRV17]. Bhattacharya et.al. gives the current best fully dynamic randomized algorithm which maintains vertex coloring in expected amortized update time [DBLP:conf/soda/BhattacharyaCHN18]. They also give the current best deterministic algorithm which maintains vertex coloring in amortized update time [DBLP:conf/soda/BhattacharyaCHN18].
In this work we study dynamic data structures for coloring of interval graphs when the input is an online update sequence of intervals. The goal is to efficiently maintain a proper coloring with as few colors as possible by an online algorithm. In the incremental model intervals are inserted one after the other and we aim to efficiently maintain a proper coloring using as few colors as possible after every update. Our approach is to consider efficient implementations of well-studied online algorithms for interval coloring. Note that an online algorithm is not allowed to re-color a vertex during the execution of the algorithm. On the other hand, an incremental algorithm is not restricted in anyway during an update step except that we desire that the updates be done as efficiently as possible. Naturally, an online algorithm is a good candidate for an incremental algorithm as it only assigns a color to the current interval, and does not change the colour of any of the other intervals. Online algorithms for interval coloring and its variants is a rich area with many results. Epstein et.al. studied online graph coloring for interval graphs [DBLP:conf/icalp/EpsteinL05]. They studied four variants of the problem : online interval coloring with bandwidth, online interval coloring without bandwidth, lazy online interval coloring with bandwidth, and lazy online interval coloring without bandwidth. For online interval coloring with bandwidth, Narayanaswamy presented an algorithm with competitive ratio 10 [DBLP:conf/cocoon/Narayanaswamy04] and Epstein et. al. showed a lower bound of [DBLP:conf/icalp/EpsteinL05]. For lazy online interval coloring with bandwidth and lazy online interval coloring without bandwidth, Epstein et.al. proved that competitive ratio can be arbitrarily bad for any online algorithm [DBLP:conf/icalp/EpsteinL05]. For the online interval coloring problem, Kierstead and Trotter presented a competitive algorithm and they also proved that their result is tight [kierstead1981extremal]. In other words, The online algorithm (KT-algorithm) due to Kierstead and Trotter [kierstead1981extremal] is known to have the optimum competitive ratio. The tightness is by showing the existence of an adaptive adversary that forces an online algorithm to use colors where is the maximum clique size in the interval graph formed by the given set of intervals. On the other hand, the KT-algorithm uses at most colors. The KT-algorithm computes a proper coloring by assigning to each vertex a color which is 2-tuple denote by level,offset. The value of level is in the range and the value of offset is from the set . Further, all the vertices whose level value is 0 form an independent set. Therefore, an efficient implementation of KT-algorithm gives us an incremental algorithm that maintains a proper coloring with at most colors.
Our Work: In Section 2.2, we show that we are unlikely to be able to design a sub-quadratic implementation of the KT-algorithm. The reason for this is that the level value assigned to an interval depends on the size of the maximum clique in the graph induced by the intervals intersecting with it. We show a reduction from the Online Boolean Matrix-Vector Multiplication(OMv) problem [DBLP:conf/stoc/HenzingerKNS15] to the problem of computing the induced subgraph of the neighbours of a vertex. By the conjecture on the OMv probem, it is unlikely to have a sub-quadratic algorithm for the Induced Subgraph Computation problem. Thus, we believe that any algorithm that depends on computing an induced subgraph is unlikely to have a sub-quadratic dynamic algorithm, even when the graph is an interval graph. We design an incremental algorithm which avoids this limitation by using a different approach to compute level value for an interval. Thus, we differ from KT-algorithm in computing the level value for an interval. However, our algorithm uses the same number of colors as the KT-algorithm. Our incremental algorithm (Theorem 2) supports insertion of a sequence of intervals in amortized update time. We have also considered the fully dynamic framework in which an interval that has already been colored can be deleted, apart from the insertions. At the end of each update, our aim is to maintain a coloring of the remaining set of intervals, where is the maximum clique in the interval graph associated with the remaining set of intervals. Our fully dynamic algorithm (Theorem 4.4.2) supports insertion of an interval in worst case update time and deletion of an interval in worst case update time. Finally, the question of significant interest to us is whether the dependence on can be sub-linear in the incremental case and whether it can be sub-quadratic in the fully dynamic case. Another interesting direction is the nature of the trade-off between the number of colors used and the update time if we allow a change of color assigned to an interval.

2 Preliminaries

denotes a set of intervals and the associated interval graph [golumbic1980algorithmic] is denoted by . For an undirected graph , denotes the size of the maximum cardinality clique in G, denotes the maximum degree of a vertex in and denotes the chromatic number of . It is well-known that for interval graphs . When the context is clear we denote as and as .

2.1 Kierstead-Trotter Algorithm - Overview

Let be the ordering of vertices of an interval graph . Each vertex in is presented to an online algorithm as the corresponding interval. Let denote the set of intervals corresponding to the vertices and vertex corresponds to the interval . We also refer to each vertex and interval along with a subscript whose range is from to . For example, when we use or we mean the -th vertex in . Throughout the paper, will be the vertex corresponding to the interval . For a given vertex from the algorithm computes a color based on the color given to the vertices . The color assigned to a vertex is a tuple of two values and is denoted as . In Step I, the first value called the level or position of the presented vertex denoted by , is computed, and in Step II the second value, called the offset denoted by , is computed from the set . The key property is that for each edge , the tuples is different from .
Step I: For , let denote the induced subgraph of on the vertex set . Define = .
Key Properties maintained by Step I [kierstead1981extremal]:

  • For each vertex , .

  • Property P : The set is an independent set. For each , , the subgraph of induced on has maximum degree at most 2.

Step II: Since there are at most two neighbours of such that their level is , is chosen to be the smallest value from the set different from the offset of these neighbours whose level is .
Analysis: All the vertices in level form an independent set, and for all these vertices the offset value is . For the vertices in levels to , maximum degree is . Therefore, the algorithm uses at most colors to color all the vertices belonging to a particular level where . Hence, total colors used by the algorithm is = .
Crucial step in the implementation of KT-algorithm: Given a vertex , the subgraph is the induced subgraph among the neighbours of which have level value at most . Computing is a very crucial step in KT-algorithm for different values of starting from until the that value of for which is true. In Section 3 we show that the search for such an can be done without computing the induced subgraphs . The motivation for this line of research is the result in Section 2.2.

2.2 KT-algorithm must avoid computing induced subgraphs

In this Section we show that the problem of computing the induced subgraph of the closed neighbourhood of a set of vertices is unlikely to have a sub-quadratic time algorithm. The input to the Induced Neighbourhood Subgraph Computation problem consists of the adjacency matrix of a directed graph and a set of vertices. The aim is to compute the graph induced by and output the subgraph. Here is the set of those vertices which have a directed edge from some vertex in . In other words, there is a directed edge from to iff the entry is . Next we show that Induced Neighbourhood Subgraph Computation problem is at least as hard as the following problem.
Online Boolean Matrix-Vector Multiplication[DBLP:conf/stoc/HenzingerKNS15]: The input for this online problem consists of an matrix , and a sequence of boolean column vectors , presented one after another to the algorithm. For each , the online algorithm should output before is presented to the algorithm. Note that in this product, a multiplication is an AND operation and the addition is an OR operation. According to the OMv conjecture, due to Henzinger et al., [DBLP:conf/stoc/HenzingerKNS15], the Online Boolean Matrix-Vector Multiplication problem does not have a algorithm for any . The current best algorithm for the Online Boolean Matrix-Vector Multiplication problems has an expected running time of [DBLP:conf/soda/LarsenW17].

We now show that an algorithm to solve the Induced Neighbourhood Subgraph Computation problem can be used to solve the Online Boolean Matrix-Vector Multiplication problem. Let be an algorithm for the Induced Neighbourhood Subgraph Computation problem with a running time of is , for some . Then, we use algorithm to solve the Online Boolean Matrix-Vector Multiplication problem in time as follows : Let be the input matrix for the Online Boolean Matrix-Vector Multiplication problem and let be the column vectors presented to the algorithm one after another. For the column vector , let set . To compute , we invoke on input . Let denote the induced subgraph on computed by the algorithm . Note that is an induced subgraph of the directed graph whose adjacency matrix is . To output the column vector , we observe that the -th row in the output column vector is 1 if and only if and there is an edge in such that . Given that has been computed in time, it follows that the number of edges in is and consequently the column vector can be computed in time. Therefore, using the algorithm we can solve Boolean Matrix-Vector Multiplication problem in time. If we believe that the OMv conjecture is indeed true, then it follows that the Induced Neighbourhood Subgraph Computation problem cannot have a algorithm for any . This conditional lower bound on the Induced Neighbourhood Subgraph Computation problem deters us from coming up with a direct implementation of the KT algorithm for the incremental setting of the online interval coloring problem. In the following section we design an online interval coloring algorithm that avoids an explicit computation of the induced subgraph on the neighbourhood of an input interval.

3 An incremental data structure for interval coloring

In this section we present an incremental algorithm which is essentially an implementation of the KT-algorithm[kierstead1981extremal]. The subtle difference is that our algorithm has a different definition of the level value of an interval. The level value that we assign is at most the level value assigned by the KT-algorithm, and thus our algorithm uses the same number of colors as the KT-algorithm. The difference in the level value is illustrated in Figure LABEL:fig:example.
Let = . We use to denote the level value computed by our algorithm and to denote the level value computed by the KT-algorithm. To compute the offset value we use the same approach as KT-algorithm as described in Section 2.1. We design appropriate data structures to compute the level and the offset associated with an vertex .
For a set of intervals , define the set = to be set of levels assigned to intervals in . Recall from Section 2 that is the -th vertex in . Let be a non-negative real number and be the set of all intervals in which contain the point . Define = i.e. is the smallest non-negative integer which is not the level value for any interval containing . If , then the Supporting Line Segment(SLS) at is defined to be the set = , and is called the height of SLS .

3.1 Insertion

We show in Lemma 3.1 that the level of interval , which is given by the maximum height of the SLS at any point contained in , is at most . We prove in Lemma 1 that level values computed by our algorithm satisfies Property P (described in Section 2.1). We also prove using Lemma 3.1 that the can be computed based on the height of the SLS at finite set of points in interval . This proof is one of our key contributions. In particular, we show that the finite set points that we need to consider in interval is the set of endpoints of the intervals intersecting with . For intervals we have at most distinct endpoints and we denote this set of endpoints by . Therefore, on insertion of interval , we first compute the set of endpoints which are in . We then query the height of the SLS at each of the points in and take the SLS with maximum height to compute .
Insertion Algorithm :
Let be the interval that is inserted in the current update step. Our algorithm computes the color by implementing Step 1 and Step 2 as described below:

  1. Computing :
    Step 1
    : Insert and into the set .
    Step 2 : Compute . For each , compute , the height of the SLS at . Let .
    Step 3 : Update the SLS for each point .

  2. Computing : We prove in Lemma 1 that level values computed by our algorithm in Step I satisfies Property P. From Property P, has at most two neighbours whose levels are . We compute to be that value from the set that is different from the offset values of the neighbours of which have the level .

Proof of Correctness : As mentioned before the description of the algorithm, the correctness of the insertion algorithm follows from the Lemma 3.1, Lemma 3.1, and Lemma 1. In the following Lemma, we show that it is sufficient to use the endpoints of the intervals to compute the level of an interval. Let be a non-negative real number and let be the set of intervals that contain . Then there exists at least one endpoint in the set which is contained in each interval in . Further, the height of the SLS at this endpoint is at least the height of the SLS at .

Proof.

If is an endpoint of an interval, then and hence the Lemma is proved. Suppose is not an endpoint. Let denote the largest left endpoint among all the intervals in and denotes the smallest right endpoint among all the intervals in . By definition, and . Since is a set of intervals, it follows that and are present in all the intervals in . Further, since both and are present in each interval in , it follows that the set of intervals that contain them is a superset of . Therefore, the height of the SLS at and is at least the height of the SLS at . Hence the Lemma. ∎

From the description in Section 2.1 we know that the level of computed by the KT-algorithm is given by = . In our algorithm, we define to be the maximum height of the SLS at any point contained in . In the following Lemma we prove . For each , is at least the maximum height of the SLS at any point in the interval .

Proof.

By definition, is the maximum height of SLS at any point contained in . By the definition of the height of an SLS at a point , we know that for each there is an interval such that , and all these intervals form a clique of size . Therefore, it follows that has a clique of size at least . Therefore, it follows that . Hence the Lemma. ∎

We show an example in Figure LABEL:fig:example, where level value computed by our algorithm is strictly less than the level value computed by the KT-algorithm. The intervals arrive in the following order : , and . Intervals , , and gets level value . KT-algorithm computes and our algorithm computes . The portion colored as violet is the overlapping portion between interval and interval .
Our algorithm satisfies Property P and thus uses at most colors.

Proof.

We first prove that the set is an independent set. Suppose not, and let two vertices and be adjacent and both have level values . Without loss of generality, let us assume that appeared before in . Therefore, at the when is presented to the algorithm, there is an endpoint of contained in where the height of the SLS is non-zero. Therefore, the insertion algorithm does not assign to be . Therefore, is an independent set. Further, for each , the same argument is used to show that for each pair of intervals and corresponding to two distinct vertices in , . We prove that for each , , the subgraph of induced on has maximum degree at most . Suppose not, and if some vertex is of degree 3 in level . We know that for two vertices with the same level value, the corresponding intervals cannot have a containment relationship between them. Therefore, it follows that the vertex of degree 3 is in a clique of 3 vertices in level . Let , , and be the clique of 3 vertices in level . The intervals corresponding to the three vertices are such that one of the intervals is contained in the union of the other two. Therefore, one of the 3 intervals contains a point for which the SLS has height . Consequently, all the 3 intervals cannot be assigned the same level value. Therefore, for each level , the maximum vertex degree in the graph induced on is at most 2.

Since we have proved that the level value computed by our algorithm satisfies Property P, we use the same procedure as KT-algorithm (described in Section 2.1) to compute the offset value. From Lemma 3.1, we know that for any interval , we have . Therefore, maximum level value of any vertex is . For level we use one color and for every other level we use colors. Therefore, total colors used by our algorithm is = . Hence the Lemma. ∎

3.2 Implementation of the incremental algorithm

We use the following data structures in our incremental algorithm. The running times for different operations on these data structures are tabulated in Table 1.

Interval Tree [de2008computational]
Method Description Worst Case Return
Running Time Value
.insert() Inserts interval into -
.delete() Deletes interval from -
.intersection() Returns a set of intervals in
that intersect with
Dynamic Array [Cormen:2009:IAT:1614191]
Method Description Amortized Running Return
Time Value
.insert() Inserts element into -
Red-Black Tree , [Cormen:2009:IAT:1614191]
Method Description Worst Case Running Time Return Value
.insert() Inserts element into . -
.delete() Deletes element from . -
.max() Returns the maximum element in .
.min() Returns the minimum element in .
.empty() Checks if the tree is empty. True/False
Table 1: Data Structures Used in the Incremental Algorithm and the Fully Dynamic Algorithm
  1. of type Interval Tree: Every interval is of the form where denotes the left endpoint of the interval and denotes the right endpoint of the interval. We maintain all the vertices corresponding to the intervals in in an interval tree . For every , along with maintaining the endpoints , we also maintain the level and offset .

  2. of type dynamic array, of type dynamic array, and of type doubly linked list: We maintain the supporting line segment at point and the height of supporting line segment using dynamic arrays , and doubly linked list . If the supporting line segment intersects with an interval whose level value is then we set to , otherwise we set to . We define the height of the supporting line segment as the index of the first in . To maintain , we define a doubly linked list which stores every index in where is in the increasing order of the value of . Note that the value stored at the head node of is . We augment with another dynamic array . For an index , if is then stores a pointer to the node in which stores the index . If is then stores NULL. Therefore, using the dynamic array , insert, delete, and search operation in can be performed in constant time. Since our algorithm is incremental, the dynamic arrays only expand. Insertion into a dynamic array takes amortized constant time [Cormen:2009:IAT:1614191]. The size of the array is the length of . During insertion, whenever size of is increased, size of is also increased and appropriate nodes are inserted in . A Query for the value of can be answered in constant time by returning the value stored in head node of . Due to an insert if changes, then we need to change the head node of to the next node in the list and delete the previous head node of . This operation also takes constant time.

  3. of type Interval Tree: We maintain the set of endpoints as an interval tree denoted by . For every interval =, we maintain the left endpoint and the right endpoint as interval and respectively in .

  4. of type Map with domain as integers and range as Interval Tree: We use the interval tree for maintaining the intervals at level to enable allocation of the offset values to the intervals whose level is .

3.3 Analysis of the incremental algorithm

Let = be the interval inserted in the current update step. We give pseudo code of our insertion algorithm (see Algorithm 1) in Section 5 and a summarized description of the procedures used in our insertion algorithm in Table 2.

GET_SLS
Description Worst-case Return
Running Time Value
Computes the supporting line segment for endpoint
and stores it in the dynamic array .
MAX_HEIGHT_OF_SLS_IN_INTERVAL
Description Worst-case Return
Running Time Value
From the interval tree , computes the set of endpoints
contained in the interval and for each ,
from the dynamic array computes the height
and returns =
UPDATE_END_POINTS
Description Amortized Return
Running Time Value
Updates the endpoints in . -
to reflect the addition of a new interval at level .
This updates the dynamic array for each
OFFSET
Description Worst-case Return
Running Time Value
Assigns an offset value to from -
by considering the offset of the intervals
intersecting it in where is the level value of
Table 2: Procedures used in the Insertion Algorithm

We analyse our algorithm by computing the time required in every step.

  1. Computing :
    Step 1 : = is inserted into . Let = . We check if is present in by an intersection query. This query takes time in the worst case.

    • If is in . Then proceed to Step 2.

    • If is not in . We use the procedure GET-SLS() to create the SLS at endpoint . The procedure GET-SLS (see Algorithm 3) works as follows :
      It performs an intersection query on with . The query returns all the intervals in which contains . Let denote the set returned by the intersection query. The worst case time required for this query is . We create dynamic arrays and , each of size . For every in the range , we set = if and = otherwise. For every = , we insert a node to the doubly linked list storing index and store the pointer to that node in . For every = , we store a NULL in . Time taken for creating the dynamic arrays and the associated linked list is . Since , time taken for the operations on dynamic arrays and associated linked list is . Total time taken by procedure GET-SLS is + = . At any level, intersects with at most intervals and we have many levels. Hence, = . Again, . Therefore, time taken by procedure GET-SLS in the worst case is .

    Same processing is repeated for = . Therefore, we have the following Lemma. Worst case time taken by Step 1 in computing of interval is . Step 2 : We use procedure MAX-HEIGHT-OF-SLS-IN-INTERVAL (see Algorithm 4) for this step. The procedure works as follows : It performs an intersection query of = on . This query returns the set of all the endpoints that intersect with . The worst case time taken by intersection query is . Further, finding the height of the SLS at one endpoint in takes constant time. Therefore, finding the maximum height of the SLS at any point in takes time . Let denote the maximum height for any endpoint . Therefore, the level value of , is set to . Since is the maximum degree in the graph, any interval can intersect with at most intervals. Therefore, = . Again, . Thus the worst case time taken by Step 2 is . Therefore, we have the following Lemma. Worst case time taken by Step 2 in computing of vertex is . Step 3 : We use procedure UPDATE-END-POINTS (see Algorithm 5) to perform this step. The procedure works as follows :
    We use the set and the level value of computed in Step 2 to update the endpoints. Let . For every endpoint we do the following : We check the length of which is the size of the array in constant time.

    1. Case A: If . In this case, we set to . We use the pointer in to delete the node in storing the value and set to NULL. If deleted node in was the head node, then we update the head node to the next node in and thus the value of also gets updated. All these operations take constant time in the worst case.

    2. Case B If . In this case, we use the standard doubling technique for expansion of dynamic arrays [Cormen:2009:IAT:1614191] until becomes strictly greater than . We also expand along with and insert appropriate nodes to . Following the standard analysis for dynamic array expansion as shown in [Cormen:2009:IAT:1614191], one can easily show that all these steps take amortized constant time. Once , the remaining operations are same as in the case A.

    To analyse the time required in Step 3, we observe that every update must perform the operations as described in case A. We refer to these operations as task M(M stands for mandatory). Some updates have to perform additional operations as described in case B. We refer to these operations as task A(A stands for additional). The time taken by each update to perform task M is . Since is the maximum degree, hence . Therefore, every update takes time to perform task M in the worst case. To analyse the time required to perform task A, we crucially use the fact that our algorithm is incremental and hence only expansions of the dynamic arrays take place. Since is the size of the maximum clique, it follows that the maximum size of a dynamic array throughout the entire execution of the algorithm is upper bounded by . Over a sequence of insertions, the total number of endpoints is upper bounded by . Therefore, we maintain at most dynamic arrays. For every such array, total number of inserts in the array and the associated doubly linked list is at most in the entire run of the algorithm. An insertion into the dynamic array takes constant amortized time and insertion into doubly linked list takes constant worst case time. Therefore, during the entire run of the algorithm total time required to perform task A on one dynamic array and its associated doubly linked list is . This implies that during the entire run of the algorithm total time spent on task A over all the updates is . Let be total time spent on Step 3 at the end of insertions. This is the sum of the total time for task A and the total time in task M. Therefore,

    [since ]
    Therefore, and we have the following Lemma. The Amortized time taken by Step in computing of vertex is .

  2. Computing :
    We have assigned level to interval . We use the map to assign color to interval . If is NULL, then we create an interval tree with as the first node. This takes constant time. Otherwise, gives us the interval tree which stores all the intervals at level . We perform an intersection query on with to obtain all the intervals that intersect with . From Property P, the maximum intervals returned by the above query is . Therefore, worst case time taken by the intersection query is = = . is the smallest color from not assigned to any of the at most two neighbours of in level .

Thus we have the following Lemma. Computing the offset value of the vertex with level value takes time in the worst case. The amortized update time of our incremental algorithm is given by the following theorem. There exist an incremental algorithm which supports insertion of a sequence of intervals in amortized time per update.

Proof.

For interval graphs, it is well known that . Therefore, using Lemma 1, Lemma 1, Lemma 1 and Lemma 2, we conclude that total time taken by our incremental algorithm for insertion of intervals is :
= Total time for Step1 + Total Time for Step 2 + Total Time for Step 3 + Total time for computing offset
= + + +
=
Therefore, the amortized update time over a sequence of interval insertions is . ∎

4 Fully Dynamic Data Structures for interval coloring

In this Section we study the interval coloring problem in the fully dynamic framework. In this framework a new interval can be inserted and a previously colored interval can be deleted. Let be an interval inserted in the current update step and let be the vertex corresponding to . We use the insertion algorithm (see Algorithm 1) as described in Section 3 to compute the color . Let be an interval deleted and let its color be . We ensure that for every other vertex , where denotes the maximum height of the supporting line segments contained in the interval . This step is crucial as it ensures that the number of levels used is at most and that the level assignment satisfies Property P. We now outline the challenges and our approach.

4.1 Challenges in implementing the Deletion and Insertion algorithms

Let = be an interval deleted and its color be .
Challenge 1: Let be the set of endpoints contained in . Let . For every other interval which contains , if then the SLS must be updated at to reflect the deletion of . Further, if and no other interval with level value contains , then we must modify to .
Challenge 2: Let be an interval. Just after the deletion of the interval , let denote the maximum height of supporting line segments contained in . is called dirty if . A vertex which is not dirty is called clean. Let denote the set of all vertices which are dirty after the deletion of . The efficiency of the delete step depends on the efficient computation of and the clean-up of so that at the end of the update, there are no dirty vertices. We also must ensure that during the clean-up of no clean vertex becomes dirty. We address challenge in Section 4.3 by using a Red-Black tree to maintain supporting line segments. We address challenge as follows : On deletion of , we initialize set = . That is, the set consists of every vertex such that and intersects with . In Lemma 4.2 we show that is a superset of all dirty vertices created due to the deletion of . In other words, we show that only those vertices which are adjacent to and those whose level number is more than that of can be dirty during the update step after the deletion of .

4.2 Update Algorithms

The algorithm executed during each update is as below :
Deletion Algorithm (For the pseudo-code, see Algorithm 2): Let be the interval deleted during the current update step. Let be the color of . The steps in the algorithm are as follows:
Step 1 : Remove interval .
Step 2 : Compute = .
Step 3 : For each endpoint , update SLS to reflect the deletion of interval .
Step 4 : Compute = .
Step 5: Consider in the increasing order of level value. Ties are broken by considering first the intervals inserted earlier. Let be the current vertex under consideration from the set . The following steps are executed for :

  • Compute = .

  • For every endpoint compute the height of the SLS at .

  • Compute = .

  • If . Then is unchanged. Prior to this update, we maintained that there is a such that . This invariants persists for .

  • If . Then,

    • Change level value of from to . This ensures that there is a such that . This invariant is ensured after the change at .

    • Compute the offset value for with level value .

    • Update SLS for every point to reflect the change in level value of .

  • Continue to the the next vertex in the set .

Insertion Algorithm (For the pseudo-code see Algorithm 1): Let be an interval inserted in the current update step. We use the insertion algorithm in Section 3 and compute the color for (see Algorithm 6).

Let be the deleted interval and let be the color of . Then all the dirty vertices during the update are contained in the set .

Proof.

Let be a vertex. By definition of the level of a vertex, we know that there is a point such that . In other words, for the SLS , is at least . Further, the Deletion algorithm maintains the invariant that whenever is modified it is changed to be the maximum , over all . Also, the vertices are processed in non-decreasing order of level number, and the level number is not increased.
We show that if , then does not become dirty due to the deletion of and during the udpate. Since , it follows that for each during the update the level is unchanged for the interval for which and . Therefore, the maximum height of a supporting line segment in at the end of the update initiated by the deletion of is at least . Therefore, .
Secondly, we show that if is not an edge, then does not become dirty due to the deletion of and during the update. If is not an edge, then the intervals and are disjoint. Therefore, . Consequently, it follows that for each during the update the level is unchanged for the interval for which and . Therefore, the maximum height of supporting line segments in after the deletion of and throughout the update is at least . Since after the deletion of it follows that . Hence the lemma.

At the end of each update, the number of colors used is at most colors, where is the size of the maximum clique in the interval graph just after the update.

Proof.

The algorithm maintains the crucial invariant after every update that for each vertex , there is a point such that . Therefore, the largest level of any vertex is at most . Further, the vertices whose level values are 0 form an independent set. Further, for each the algorithm maintains the following invariant that whenever is modified: is modified to be the maximum , over all . Next, we claim that when changes it has at most two neighbors in the new level and none of the neighbors has a containment relationship with . The proof is by contradiction by assuming that is the first vertex for which this claim is false. The contradiction is obtained by using the argument in Lemma 1. Therefore, it follows that after the update step, Property is satisfied by the level assignment to the vertices. Consequently, the algorithm uses at most colors after each update step. Hence the Lemma. ∎

4.3 Implementation of the fully dynamic algorithm

In this section we describe the data structures that we use for the implementation of our fully dynamic algorithm. The following data structures are same as described in Section 3.2 :

  • Interval Tree to maintain all the intervals. For every vertex , we maintain , the level value , the offset value and the time of insertion (if update inserts vertex then we store as the time of insertion for vertex ).

  • Interval Tree to maintain the set of endpoints.

  • Map with domain as integer and range as interval tree for computing the offset value.

The only data structure which is different from Section 3.2 is the data structure that we use to maintain the supporting line segments. Fort he fully dynamic algorithm, we maintain the supporting line segments as follows : For an SLS at point , we use two Red-Black trees, and . A level value is stored in if there is no interval in whose level value is and it contains . A level value is stored in if there is an interval in whose level value is and it contains . To compute the height of an SLS we do the following : If is non empty then minimum value in the tree is the height of SLS at . If is empty then height of SLS at is one more than the maximum value in the tree . We know that and . Therefore, time required to find the height of an SLS is . Running times for different operations on these data structures are tabulated in Table 1.

We address challenge 1 after deleting interval as follows: We delete from interval tree and . To find the set of endpoints , we query the interval tree with interval . For every endpoint , we query . If this query returns NULL then we delete from the Red-Black tree and insert to the Red-Black tree . We analyse all these operations in details in Section 4.4.

4.4 Analysis of the fully dynamic algorithm

We give a summarized description of the procedures used in our fully dynamic algorithm in Table 3. We present pseudo codes for our algorithm and procedures in Section 5. In this Section we present a worst case analysis of every step in our algorithm. We first analyse worst case performance of every step in our deletion algorithm and present a worst update time for deletion. Then we analyse worst case performance of every step in our insertion algorithm and present a worst update time for insertion.

GET_SLS
Description Worst-case Return
Running Time Value
Computes the supporting line segment for endpoint
and stores it in the Red Black Tree and .
MAX_HEIGHT_OF_SLS_IN_INTERVAL
Description Worst-case Return
Running Time Value
From the interval tree , computes the set of endpoints
contained in the interval and for each ,
,using the Red Black trees and , computes the height
and returns the maximum height =
UPDATE_END_POINTS
Description Worst-case Return
Running Time Value
Updates the endpoints in . -
to reflect the addition of a new interval at level .
This updates the Red Blach trees and for each
OFFSET
Description Worst-case Return
Running Time Value
Assigns an offset value to from -
by considering the offset of the intervals
intersecting it in where is the level value of
Table 3: Procedures used in the Fully Dynamic Algorithm

4.4.1 Analysis of Deletion Algorithm :

Let be the interval that is deleted in the current update step. Let be the total number of intervals inserted during the course of execution of the algorithm. We analyse the worst case time required in every step.
Step 1 : We remove from interval tree and interval tree . We know that and . Therefore, this step takes time in the worst case.
Step 2 : To compute = , we perform an intersection query on with . The time required by the query to return the set is . We know that and . Therefore, worst case time required by this step is .
Step 3 : We need to update SLS for every endpoint . To do so, we check if there is another interval with level value equal to that contains . From property P, after removing , there can be at most two intervals with level value that contains . We perform this check using an intersection query on with . Worst case time required by this query is = . If this query returns a NULL, then we delete from the tree and insert into the tree . Since and , time required for deletion from and insertion to is . Therefore, total time required for one is . We know that . Therefore, worst case time required by this step is = .
Step 4 : We need to compute the set = . To compute , we perform an intersection query on with