Dynamic and Kinetic Conflict-Free Coloring of Intervals with Respect to Points

We introduce the dynamic conflict-free coloring problem for a set $S$ of intervals in $\mathbb{R}^1$ with respect to points, where the goal is to maintain a conflict-free coloring for $S$ under insertions and deletions. We investigate trade-offs between the number of colors used and the number of intervals that are recolored upon insertion or deletion of an interval. Our results include: - a lower bound on the number of recolorings as a function of the number of colors, which implies that with $O(1)$ recolorings per update the worst-case number of colors is $\Omega(\log n/\log\log n)$, and that any strategy using $O(1/\varepsilon)$ colors needs $\Omega(\varepsilon n^{\varepsilon})$ recolorings; - a coloring strategy that uses $O(\log n)$ colors at the cost of $O(\log n)$ recolorings, and another strategy that uses $O(1/\varepsilon)$ colors at the cost of $O(n^{\varepsilon}/\varepsilon)$ recolorings; - stronger upper and lower bounds for special cases. We also consider the kinetic setting where the intervals move continuously (but there are no insertions or deletions); here we show how to maintain a coloring with only four colors at the cost of three recolorings per event and show this is tight.


Introduction
Consider a set S of fixed base stations that can be used for communication by mobile clients. Each base station has a transmission range, and a client can potentially communicate via that base station when it lies within the transmission range. However, when a client is within reach of several base stations that use the same frequency, the signals will interfere. Hence, the frequencies of the base stations should be assigned in such a way that this problem does not arise. Moreover, the number of used frequencies should not be too large. Even et al. [7] and Smorodinsky [11] introduced conflict-free colorings to model this problem, as follows. Let S be a set of disks in the plane, and for a point q ∈ R 2 let S(q) ⊆ S denote the set of disks containing the point q. A coloring of the disks in S is conflict-free if, for any point q ∈ R 2 , the set S(q) has at least one disk with a color that is unique among the disks in S(q). Even et al. [7] proved that any set of n disks in the plane admits a conflict-free coloring with O(log n) colors, and this bound is tight in the worst case.
The concept of conflict-free colorings can be generalized and extended in several ways, giving rise to a host of challenging problems. Below we mention some of them; a more extensive overview is given by Smorodinsky [12]. One obvious generalization is to work with types of regions other than disks. For instance, Even et al. [7] showed how to find a coloring with O(log n) colors for a set of translations of any single centrally symmetric polygon. Har-Peled and Smorodinsky [9] extended this result to regions with near-linear union complexity. One can also consider the inverse setting, where one wants to color a given set P of n points in the plane, such that any disk-or rectangle, or other range from a given family-contains at least one point with a unique color (if it contains any point at all). This too was studied by Even et al. [7] and they show that this can be done with O(log n) colors when the ranges are disks or scaled translations of a single centrally symmetric convex polygon.
The results mentioned above deal with the static setting, in which the set of objects to be colored is known in advance. This may not always be the case, leading Fiat et al. [8] to introduce the online version of the conflict-free coloring problem. Here the objects to be colored arrive one at a time, and each object must be colored upon arrival. Fiat et al. show that when coloring points in the plane with respect to disks, n colors may be needed in the online version. Hence, they turn their attention to the 1-dimensional problem of online coloring points with respect to intervals. They prove that this can be done deterministically with O(log 2 n) colors and randomized with O(log n log log n) colors with high probability. Later Chen [5] gave a randomized algorithm that uses O(log n) colors with high probability. Similar results were also obtained for conflict-free colorings of points with respect to halfplanes, unit disks and axis-aligned rectangles of almost the same size. In these cases the colorings use O(polylog n) colors with high probability. Bar-Noy et al. [1] considered the case where recolorings are allowed for each insertion. They prove that for coloring points in the plane with respect to halfplanes, one can obtain a coloring with O(log n) colors in an online setting at the cost of O(n) recolorings in total. More recent variants include strong conflict-free colorings [4,10], where we require several unique colors, and conflictfree multicolorings [2], which allow assigning multiple colors to a point.
Our contributions. We introduce a variant of the conflict-free coloring problem where the objects to be colored arrive and disappear over time. This dynamic conflict-free coloring problem models a scenario where new base stations may be deployed (to deal with increased capacity demands, for example) and existing base stations may break down or be taken out of service (either permanently or temporarily). This natural variant has, to the best of our knowledge, not been considered so far. It is easy to see that, unless one maintains a regular coloring in which any two intersecting objects have distinct colors, there is always a sequence of deletions that invalidates a given conflict-free coloring. Hence, recolorings are needed to ensure that the new coloring is conflict-free. This leads to the question: how many recolorings are needed to maintain a coloring with a certain number of colors? We initiate the study of dynamic conflict-free colorings by considering the problem of coloring intervals with respect to points. In this variant, we are given a (dynamic) set S of intervals in R 1 , which we want to color such that for any point q ∈ R 1 the set S(q) of intervals containing q contains an interval with a unique color. In the static setting, coloring intervals is rather easy: a simple procedure yields a conflict-free coloring with three colors. The dynamic version turns out to be much more challenging.
In Section 2 we prove lower bounds on the possible tradeoffs between the number of colors used and the worst-case number of recolorings per update: for any algorithm that maintains a conflictfree coloring on a sequence of n insertions of intervals with at most c(n) colors and at most r(n) recolorings per insertion, we must have r(n) > n 1/(c(n)+1) /(8c(n)). This implies that for O(1/ε) colors we need Ω(εn ε ) recolorings, and with only O(1) recolorings we must use Ω(log n/ log log n) colors.
In Section 3 we then present several algorithms that achieve bounds close to our lower bound. First, we present two algorithms for the case where the interval endpoints come from a universe of size U . One algorithm uses O(log U ) colors and two recolorings per update; the other uses O(log t U ) colors and O(t) recolorings per update, where 2 t U is a parameter. We then extend the second algorithm to an unbounded universe, leading to two results: we can use O(log t n) colors and perform O(t log t n) recolorings for any fixed t 2, or we can use O(1/ε) colors and O(n ε /ε) recolorings (amortized) for any fixed ε > 0.
In Section 4 we investigate the online (that is, insertion-only) setting without recoloring. We do this for the special case of nested intervals, for which we provide a matching upper and lower bound of log 2 n + 1 colors. Note that the lower bound of course also holds for arbitrary intervals.
Finally, in Section 5 we turn our attention to kinetic conflict-free colorings. Here the intervals do not appear or disappear, but their endpoints move continuously on the real line. At each event where two endpoints of different intervals cross each other, the coloring may need to be adapted so that it stays conflict-free. One way to handle this is to delete the two intervals involved in the event, and re-insert them with the new endpoint order. We show that a specialized approach is much more efficient: we show how to maintain a conflict-free coloring with four colors at the cost of three recolorings per event. We also show that on average Θ(1) recolorings per event are needed in the worst case when using only four colors.

Lower bounds for semi-dynamic conflict-free colorings
In this section we present lower bounds on the semi-dynamic (insertion only) conflict-free coloring problem for intervals. More precisely, we present lower bounds on the number of recolorings necessary to guarantee a given upper bound on the number of colors. We prove a general lower bound and a stronger bound for so-called local algorithms. The general lower bound uses a construction where the choice of segments to be added depends on the colors of the segments already inserted. This adaptive construction is also valid for randomized algorithms, but it does not give a lower bound on the expected behavior.
Theorem 2.1. Let alg be an insertion-only deterministic algorithm for the dynamic conflictfree coloring of intervals. Suppose that on any sequence of n > 0 insertions, alg uses at most c(n) colors and r(n) recolorings per insertion, where r(n) > 0. Then r(n) > n 1/(c(n)+1) /8c(n).
Proof. We first fix a value for n and define c := c(n) and r := r(n). Our construction will proceed in rounds. In the i-th round we insert a set R i of n i disjoint intervals-which intervals we insert depends on the current coloring provided by alg. After R i has been inserted (and colored by alg), we choose one of the colors used by alg for R i to be the designated color for the i-th round. We denote this designated color by c i . We will argue that in each round we can pick a different designated color, so that the number of rounds, ρ, is a lower bound on the number of colors used by alg. We then prove a lower bound on ρ in terms of n, c, and r, and derive the theorem from the inequality ρ c.
To describe our construction more precisely, we need to introduce some notation and terminology. Let R i := {I 1 , . . . , I ni }, where the intervals are numbered from left to right. (Recall that the intervals in R i are disjoint.) To each interval I = I j we associate the set I e := (a, b), where a is the right endpoint of I, and b is the left endpoint of I j+1 if j < n i and +∞ if j = n i , that is, I e represents the empty space to the right of I. We call (I, I e ) an i-brick. We define the color of a brick (I, I e ) to be the color of I, and we say a point or an interval is contained in this brick if it is contained in I ∪ I e . Recall that each round R i has a designated color c i . We say that an i-brick B := (I, I e ) is living if the following two conditions are met: • I has the designated color c i ; • if i > 1 then both I and I e contain living (i − 1)-bricks.
A brick that is not alive is called dead and an event such as a recoloring that causes a brick to become dead is said to kill the brick. By recoloring an interval I, alg can kill the brick B = (I, I e ) and the death of B may cause some bricks containing B to be killed as well.
We can now describe how we generate the set R i of intervals we insert in the i-th round and how we pick the designated colors. We denote by R * i the subset of intervals I ∈ R i such that (I, I e ) is a living i-brick. Note that R * i can be defined only after the i-th round, when we have picked the designated color c i .
1. The set R 1 contains the n 2 intervals [0, 1], [2,3], . . . , [2n−2, 2n−1], and the designated color c 1 of the first round is the color used most often in the coloring produced by alg after insertion of the last interval in R 1 . (Note that the designated color of a round is fixed once it is picked; it is not updated when recolorings occur.) group G of 4r intervals from living bricks first interval in next group G I G I G Figure 1: Example of how the intervals are created when r = 2. The designated color c i−1 is blue, and the grey rectangles around them indicate living (i − 1)-bricks. The grey rectangle around I G indicates the brick (I G , I e G ). Note that I G extends further to the right.
2. To generate R i for i > 1, we proceed as follows. Partition R * i−1 into groups of 4r consecutive intervals. (If |R * i−1 | is not a multiple of 4r, the final group will be smaller than 4r. This group will be ignored.) For each group G := I 1 , . . . , I 4r we put an interval I G into R i , which starts at the left endpoint of I 1 and ends slightly before the left endpoint of I 2r+1 ; see Fig. 1 for an illustration.
The designated color c i is picked as follows. Consider the coloring after the last interval of R i has been inserted, and let C(i) be the set of colors assigned by alg to intervals in R i and that are not a designated color from a previous round-we argue below that C(i) = ∅. Then we pick c i as the color from C(i) that maximizes the number of living i-bricks.
We continue generating sets R i in this manner until |R * i | < 4r, at which point the construction finishes. Below we prove that in each round alg must introduce a new designated color, and we prove a lower bound on the number of rounds in the construction. Now consider the situation after the i-th round, but before we have chosen the designated color c i . We say that a color c is eligible (to become c i ) if c = c 1 , . . . , c i−1 , and we say that an i-brick (I, I e ) is eligible if its color is eligible and (I, I e ) would be living if we were to choose its color as the designated color c i .
Claim. Immediately after the i-th round, at least half of the i-bricks are eligible. Proof. Consider an i-brick (I, I e ). At the beginning of the i-th round, before we have actually inserted the intervals from R i , both the interval I and its empty space I e contain 2r living (i − 1)bricks. As the intervals from R i are inserted, alg may recolor certain intervals from R 1 ∪. . .∪R i−1 , thereby killing some of these (i − 1)-bricks. Now suppose that alg recolored at most 2r − 1 of the intervals from R 1 ∪ . . . ∩ R i−1 that are contained in I ∪ I e . Then both I and I e still contain a living (i − 1)-brick. By the previous claim, this implies alg cannot use any of the colors c j with j < i for I. Hence, the color of I is eligible and the i-brick (I, I e ) is eligible as well.
It remains to observe that alg can do at most rn i recolorings during the i-th round. We just argued that to prevent an i-brick from becoming eligible, alg must do at least 2r recolorings inside that brick. Hence, alg can prevent at most half of the i-bricks from becoming eligible.
Recall that after the i-th round we pick the designated color c i that maximizes the number of living i-bricks. In other words, c i is chosen to maximize |R * i |. Next we prove a lower bound on this number. Recall that ρ denotes the number of rounds.
Claim. For all 1 i ρ we have |R * i | n 1 /(8rc) i − 1. Proof. Since alg can use at most c colors, we have |R * 1 | n 1 /c. Moreover, for i > 1 the number of intervals we insert is |R * i−1 |/4r . By the previous claim at least half of these are eligible. The eligible intervals have at most c different colors, so if we choose c i to be the most common color among them we see that |R * i | |R * i−1 |/4r /2c. We thus obtain the following recurrence: We can now prove the result using induction.
Finally we can derive the desired relation between n, c, and r. Since n 1 = n/2 and n i+1 < n i /2 for all i = 1, . . . , ρ−1, the total number of insertions is less than n. The construction finishes when |R * i | < 4r. Hence, ρ, the total number of rounds, must be such that |R * ρ | = n/(2(8rc) ρ ) − 1 < 4r, which implies ρ > log 8rc (n/(8r +2)) > log 8rc n−1. The number of colors used by alg is at least ρ, since every round has a different designated color. Thus c > log 8rc n − 1 and so n (8rc) c+1 , from which the theorem follows.
Two interesting special cases of the theorem are the following: with r = O(1) we will have c = Ω (log n/ log log n), and for c = O(1/ε) (for some fixed ε > 0) we need r = Ω (εn ε ). Note that the theorem requires r > 0. Obviously the Ω (log n/ log log n) lower bound on c that we get for r = 1 also holds for r = 0. For the special case of r = 0-this is the standard online version of the problem-we can prove a stronger result, however: here we need at least log n + 1 colors-see Section 4. This bound even holds for a nested set of intervals, that is, a set S such that I ⊂ I or I ⊂ I for any two intervals I, I ∈ S. We also show that a greedy algorithm achieves this bound for nested intervals.
Local algorithms. We now prove a stronger lower bound for so-called local algorithms. Intuitively, these are deterministic algorithms where the color assigned to a newly inserted interval I only depends on the structure and the coloring of the connected component where I is insertedhence the name local. More precisely, local algorithms are defined as follows.
Suppose we insert an interval I into a set S of intervals that have already been colored. The union of the set S ∪ {I} consists of one or more connected components. We define S(I) ⊆ S to be the set of intervals from S that are in the same connected component as I. We now define a dynamic algorithm alg to be local if upon insertion of an interval I the following holds: (i) alg only performs recoloring in S(I), and (ii) the color assigned to I and the recolorings in S(I) are uniquely determined by sig(I), that is, the algorithm is deterministic with respect to sig(I). Note that randomized algorithms are not local.
To strengthen Theorem 2.1 for the case of local algorithms, it suffices to observe that the intervals inserted in the same round must all receive the same color. Hence, the factors c in the denominators of Inequality (1) disappear, leading to the theorem below. Note that for r(n) = O(1), we now get the lower bound c(n) = Ω(log n).
Theorem 2.2. Let alg be a local insertion-only algorithm for the dynamic conflict-free coloring of intervals. Suppose that on any sequence of n > 0 insertions, alg uses at most c(n) colors and r(n) recolorings per insertion, where r(n) > 0. Then r(n) n 1/(c(n)+2) − 2.
Proof. We first fix a value for n and define c := c(n) and r := r(n). Similar to the previous construction, this construction also proceeds in rounds. In the i-th round we insert a set R i of n i disjoint intervals. We will argue that in each round alg picks a different color, so that the number of rounds, ρ, is a lower bound on the number of colors used by alg. We then prove a lower bound on ρ in terms of n, c, and r, and derive the theorem from the inequality ρ c.
In the i-th round, we insert the following intervals: . Since all intervals are disjoint, the local information alg can use for each interval consists only of that single interval. Hence, since alg is deterministic, it colors all intervals in R 1 with the same color.
2. To generate R i for i > 1, we proceed as follows. Partition R i−1 into groups of r + 2 consecutive intervals. (If |R i−1 | is not a multiple of r + 2, the final group will be smaller than r + 2. This group will be ignored.) For each group G := I 1 , . . . , I r+2 we put an interval I G into R i , which starts at the left endpoint of I 1 and ends slightly before the left endpoint of I r+2 . Since local information for alg for each of these intervals is the same and alg is deterministic, it colors all intervals of R i using the same color and the output signature of S(I) is the same for all I ∈ R i .
We continue generating sets R i in this manner until |R * i | < r + 1, at which point the construction finishes. Note that if R ρ−1 consists of exactly r + 1 intervals, we cannot apply the above construction as it is. In this case, R ρ consists of a single interval which starts at the left endpoint of I 1 and ends at 2n − 1, that is the new intervals contains every other interval.
By construction, for each interval in R i , for i ∈ {1, . . . , ρ}, and for each j ∈ {1, . . . , i} there is a point q ∈ I that is contained in a single interval of R j and in no other interval from R 1 ∪ · · · ∪ R i . Moreover, the rightmost point of I is not contained in any interval from R 1 ∪· · ·∪R i . Furthermore, since for each newly inserted interval I alg can only recolor r out of the r +1 intervals I intersects, these properties remain valid during the insertion process.
Proof. Since alg colors all intervals of R 1 using the same color, we have |R 1 | = n/2. Moreover, since for i > 1 the number of intervals we insert is |R i−1 |/(r + 2) , we have |R i | |R i−1 |/(r + 2) . We thus obtain the following recurrence: We can now prove the result using induction.
Finally we can derive the desired relation between n, c, and r. Since |R 1 | = n/2 and |R i+1 | < |R i |/2 for all i = 1, . . . , ρ − 1, the total number of insertions is less than n. The construction finishes when |R i | < r + 1. Hence, ρ, the total number of rounds, must be such that which implies ρ > log r+2 (n/(2r + 6)) > log r+2 n − 2. The number of colors used by alg is at least ρ, since every round uses a different. Thus c > log r+2 n − 2 and so n (r + 2) c+2 , from which the theorem follows.

Upper bounds for dynamic conflict-free colorings
Next we present algorithms to maintain a conflict-free coloring for a set S of intervals under insertions and deletions. The algorithms use the same structure, which we describe first. From now on, we use n to denote the current number of intervals in S.
Let P be the set of 2n endpoints of the intervals in S. (To simplify the presentation we assume that all endpoints are distinct, but the solution is easily adapted to the general case.) We will maintain a B-tree on the set P . A B-tree of minimum degree t on a set of points in R 1 is a multi-way search tree in which each internal node has between t and 2t children (except the root, which may have fewer children) and all leaves are at the same level; see the book by Cormen et al. [6, Chapter 18] for details. Thus each internal or leaf node stores between t−1 and 2t−1 points from P (again, the root may store fewer points). We denote the set of points stored in a node v by P (v) := {p 1 (v), . . . , p nv (v)}, where n v := |P (v)| and the points are numbered from left to right. For an internal node v we denote the i-th subtree of v, where 1 i n v + 1, by T i (v). Note that the search-tree property guarantees that all points in T i (v) lie in the range (p i (v), p i+1 (v)).
We now associate each interval I ∈ S to the highest node v such that I contains at least one of the points in P (v), either in its interior or as one of its endpoints. Thus our structure is essentially an interval tree [3, Chapter 10] but with a B-tree as underlying tree structure. We denote the set of intervals associated to a node v by S(v). Note that if level(v) = level(w) = , for some nodes v = w, and I ∈ S(v) and I ∈ S(w), then I and I are separated by a point p i (z) of some node z at level m < . Hence, (A.2) For each node v at level in T , the intervals from S extr (v) are colored locally conflictfree using colors from C( ). Here locally conflict-free means that the coloring of S extr (v) is conflict-free if we ignore all other intervals.
(A.3) All non-extreme intervals receive a universal dummy color, which is distinct from any of the other colors used, that is, the dummy color is not in C( ) for any level .
The two coloring algorithms that we present differ in the size of the sets C( ) and in which local coloring algorithm is used for the sets S extr (v). Before we describe them we first prove that the properties above guarantee a conflict-free coloring. Proof. The bound on the number of colors is trivial. To prove that the coloring is conflictfree, consider any point q ∈ I∈S I. Let I q ∈ S be such that q ∈ I q and let v and i be such , and so S extr (v) contains at least one interval containing q. Since S extr (v) is locally conflict-free, there is an interval I * ∈ S extr (v) whose color is unique among the intervals in S extr (v) that contain q. It remains to argue that there can be no interval I ∈ S \ S extr (v) with the same color as I * and containing q. Any interval I with the same color as I * must be an extreme interval in some node w at the same level as v. However, if I * ∈ S(v), I ∈ S(w), v = w, and level(v) = level(w), then I * ∩ I = ∅. Hence, I cannot contain q.
Next we describe two algorithms based on this general framework: one for the easy case where the interval endpoints come from a finite universe, and one for the general case.
Solutions for a polynomially-bounded universe. The framework above uses a B-tree on the interval endpoints. If the interval endpoints come from a universe of size U -for concreteness, assume the endpoints are integers in the range 0, . . . , U − 1-then we can use a B-tree on the set {0, . . . , U − 1}. Thus the B-tree structure never has to be changed. (i) We can maintain a conflict-free coloring on S that uses O(log U ) colors and that performs at most two recolorings per insertion and deletion.
(ii) For any t with 2 t U , we can maintain a conflict-free coloring on S that uses O(log t U ) colors and performs O(t) recolorings per insertion and deletion.
Proof. For both results we use the general framework described above.
(i) We pick |C( )| = 4t − 2 for all levels . Since a B-tree of minimum degree t on U points has height O(log t U ), the total number of colors is O(t log t U ). With 4t − 2 colors, we can give each interval in S extr (v) its own color, so the coloring is locally conflict free. To get O(log U ) colors we now pick t = 2. To insert an interval I, we find the set S i (v) into which I should be inserted, and check if I should replace the current left-extreme and/or right-extreme interval in S i (v). Thus an insertion requires at most two recolorings. Deletions can be handled in a similar way: if I is an extreme interval, then we have to recolor at most two intervals that become extreme after the deletion of I.
(ii) We pick |C( )| = 2 for all levels , yielding O(t log t U ) colors in total. We now color S extr (v) using the chain method, as follows. Consider a single connected component of I∈Sextr(v) I and suppose C(level(v)) = {red, blue}. Let I 1 be the interval with the leftmost left endpoint in this component. We color I 1 red. Then, of all intervals whose left endpoint lies inside I 1 we select the interval I 2 with the rightmost right endpoint and color it blue, of all intervals whose left endpoint lies inside I 2 we select the interval I 3 sticking out furthest to the right and color it red, and so on. This way we create a chain of intervals that are alternatingly colored red and blue, which together cover the connected component; see Fig. 3. All intervals in this connected component that are not in the chain get the dummy color.
After coloring every connected component of S extr (v) in this manner we have a locally conflict-free coloring of S extr (v). Insertions and deletions into S(v) are simply handled by updating S extr (v) and recoloring S extr (v) from scratch. Since at most two intervals start or stop being extreme and |S extr (V )| 4t − 2, we use O(t) recolorings.
When U is polynomially bounded in n-that is, that U = O(n k ) for some constant k-this gives very efficient coloring schemes. In particular, we can then get O(log n) colors with at most two recolorings using method (i), and we can get O(1/ε) colors with O(n ε ) recolorings (for any fixed ε > 0) by setting t = U ε/k in method (ii).
Note finally that we do not need to explicitly store the whole tree as it is enough to compute the location of any node when needed, yielding a linear space complexity.
A general solution. If the interval endpoints do not come from a bounded universe then we cannot use a fixed tree structure. Next we explain how to deal with this when we apply the method from Theorem 3.2(ii), which colors the sets S extr (v) using the chain method.
Suppose we want to insert a new interval I into the set S. We first insert the two endpoints of I into the B-tree T . Inserting an endpoint p can be done in a standard manner. The basic operations for an insertion are (i) to split a full node and (ii) to insert a point into a non-full leaf node.
Splitting a full node v (that is, a node with 2t − 1 points) is done by moving the median point into the parent of v, creating a node containing the t − 1 points to the left of the median and another node containing the t − 1 points to the right of the median. Note that this means that some intervals from S(v) may have to be moved to S(parent(v)). Thus splitting a node v involves recoloring intervals in S(v) and S(parent(v)). Observe that an interval only needs to be recolored if it was extreme before or after the change. Hence, we recolor O(t) intervals when we split a node v.
Since an insertion splits only nodes on a root-to-leaf path and the depth of T is O(log t n), the total number of recolorings due to node splitting is O(t log t n). Moreover, inserting a point into a non-full leaf node takes only O(t) recolorings. We conclude that an insertion performs O(t log t n) recolorings in total.
For deletions the argument is similar. Deletions in B-trees rely on three basic operations. The first basic operation is to merge two nodes, v and v . This is the reverse of the splitting operation in an insert, and it requires recoloring intervals only from v, v and their common parent. The second basic operation is to swap the point p stored in v with its successor (or predecessor) p . This may move intervals containing p , but not p up to v. These intervals can all be found in the path from v to v , so we recolor in at most O(log t n) nodes. Fortunately this operation is done only once. The third operation takes a node v, moves a point from parent(v) into v and a point from a sibling of v into parent(v). This requires recoloring at the three nodes involved. The final operation is to delete a point from a leaf, which requires recoloring only at the leaf itself. Since recoloring at a single node induces O(t) recolorings, the total number of recolorings is O(t log t n). (i) For any fixed t 2 we can maintain a conflict-free coloring on S that uses O(log t n) colors and that performs O(t log t n) recolorings per insertion and deletion, where n is the current number of intervals in S. In particular, we can maintain a conflict-free coloring with O(log n) colors using O(log n) recolorings.
(ii) For any fixed ε > 0 we can maintain a conflict-free coloring on S that uses O(1/ε) colors and that performs O(n ε /ε) recolorings per insertion or deletion. The bound on the number of recolorings is amortized.
Proof. Part (i) follows from the discussion above, where we set t := 2 in the second statement. The idea for part (ii) is to set t := n ε . However, n will change due to updates, and t should be fixed. Hence, we rebuild T regularly. More precisely, suppose we rebuild the structure at some point. (The first insertion can be considered the first rebuild.) In this rebuild operation we set t := n ε last , where n last is the current number of points in the set. We keep working with this value of t until the size of S falls below n last /2 or gets above 2n last , at which point we perform another rebuild operation. We can account for the recolorings of the rebuild operation by charging (at most) two recolorings to each update that took place since the previous rebuild operation.
Unfortunately we have not been able to efficiently generalize the first method of Theorem 3.2 to the case where we do not have a bounded universe. The problem is that splitting a node v sometimes requires many intervals in S extr (v) to be recolored, since many intervals may be moved to parent(v). Hence, the method would use the same number of recolorings as the chain method, while it uses more colors.
Bounded-length intervals. Next we present a simple method that allows us to improve the bounds when the intervals have length between 1 and L for some constant L > 1.
Theorem 3.4. Let S be a dynamic set of intervals with lengths in the range [1, L) for some fixed L > 1. Suppose we have a dynamic conflict-free coloring algorithm for a general set of intervals that uses at most c(n) colors and at most r(n) recolorings for any insertion or deletion. Then we can obtain a dynamic conflict-free coloring algorithm on S that uses at most 2 · c(2L) + 1 colors and at most 2 · r(2L) + 1 recolorings for any insertion or deletion.
Proof. For each pair of integers i, j so that i 0 and 0 j < L let x i,j := iL+j, and for each i 0 define X i := {x i,j : 0 j < L}. Note that the point sets X i form a partition of the non-negative integer points in R 1 into subsets of L consecutive points. We assign each interval I ∈ S to the leftmost point x i,j contained in it, and we denote the subset of intervals assigned to a point in X i by S i . We will color each subset S i separately. Since an interval in S i can intersect intervals only in S i−1 ∪ S i ∪ S i+1 , we can use the same color set for all S i with i even, and the same color set for all S i with i odd. It remains to argue that we can maintain a coloring for S i using c(2L) colors (in addition to a global dummy color) and 2 · r(2L) + 1 recolorings.
Let S extr (x i,j ) contain the two extreme intervals assigned to x i,j : the interval sticking out furthest to the left and, among the remaining intervals, the one sticking out furthest to the right. We give each non-extreme interval the dummy color and maintain a conflict-free coloring for S extr (i) := j S extr (x i,j ). When we insert a new interval into S i it replaces at most one extreme interval, so we do at most one insertion and one deletion in S extr (i). Thus we do at most 2 · r(2L) + 1 recolorings. (The +1 is because the interval that becomes non-extreme is recolored to the dummy color.) For deletions the argument is similar.
For instance, by applying Theorem 3.3(i) we can maintain a coloring with O(log L) colors and O(log L) recolorings. We can also plug in a trivial dynamic algorithm with c(n) = n and r(n) = 0 to obtain 4L + 1 colors with only 1 recoloring per update; when L is sufficiently small this gives a better result.

Online conflict-free colorings
In this section we consider recolorings to be too expensive and hence forbid them all together. In this setting, any conflict-free coloring must be a proper coloring if we allow deletions: if any point is contained in two intervals of the same color, then deleting all other intervals would result in a conflict. Thus we would need n colors in the worst case. We therefore only allow insertions, that is, we study the online version. Since Theorem 2.1 does not cover the case r = 0, we start by proving a lower bound.
Theorem 4.1. For each n > 0, there is a sequence of n intervals for which any online conflict-free coloring requires at least log 2 n + 1 colors.
Proof. We reduce the static conflict-free coloring problem for n points with respect to intervals in R 1 to the online problem for coloring intervals with respect to points. The former problem asks for a coloring of the n given points, which we can assume to be the integers 1, . . . , n, such that for any two points p, q, the subset of consecutive points between p and q has a unique color. Since this problem requires log 2 n + 1 colors [7], this reduction proves the theorem.
We map the instance I{1, . . . , n} to an instance I of the online conflict-free coloring of intervals as follows: for each i = 1, . . . , n, we insert the interval I i := [−i, i] at time i. See Fig. 4 for an illustration.  First, since q is not contained in I i−1 = [−i + 1, i − 1], and I i−1 contains all intervals with lower index, q is not contained in I for < i. Moreover, since q is contained in I i = [−i, i] and I i is contained in any higher indexed interval, q is also contained in those. Since we are at time j, only intervals I 1 , . . . , I j are present. Thus, at time j, the point q is indeed contained in exactly the intervals of S , which concludes the proof.
Notice that the intervals in the lower-bound construction are nested, that is, any two intervals are either disjoint or one contains the other. We show that for inputs restricted to such nested intervals a simple greedy algorithm requires only log 2 n + 1 colors.
Labels the colors as 0, 1, 2, 3, . . . in the order in which they are introduced. For each newly inserted interval, the greedy algorithm gives it the dummy color 0 if it is contained in another interval; otherwise, it gets the smallest color c 1 that keeps the coloring conflict-free. Next we prove that this greedy algorithm with a dummy color is optimal on nested intervals. Theorem 4.2. The greedy algorithm with a dummy color uses at most log 2 n + 1 colors on nested instances.
Proof. We prove the following statement: the algorithm uses color i 1 only on intervals that cover at least 2 i−1 − 1 other intervals. If this holds, then the algorithm indeed uses at most log 2 n + 1 colors.
We prove the statement by induction. The case i = 1 is obvious. Now assume it holds for i − 1 1. Let I i be the first interval for which the algorithm uses color i. Since the algorithm did not use colors 1, · · · , i−1, there is a query point q contained in exactly one interval of color i−1, which we denote by I i−1 . By the induction hypothesis, I i−1 contains at least 2 i−2 − 1 intervals. Let S i−1 be the set of intervals contained in I i−1 . We now prove any interval of color i − 2 or lower would have received the same color on an instance without S i−1 and I i−1 .
Claim. For any color k i − 2, an interval I k can use color k on the full instance if and only if it can use it on the same instance without S i−1 and I i−1 .
Proof. Without loss of generality, I k ⊃ I i . If I k can use color k with S i−1 and I i−1 , it can also use color k without these intervals: The coloring at any point q / ∈ S i−1 is unaffected and the coloring at q ∈ S i−1 is identical to that at any point to the left and right of S i−1 , since the intervals are nested. Now if I k can use color k without S i−1 and I i−1 , then on the instance with S i−1 and I i−1 , for every point q / ∈ S i−1 , the coloring is still conflict free. Moreover, for any point q ∈ S i−1 , the coloring is also conflict free as k i − 2, implying that color i − 1 is unique among the intervals covering q.
Recall that any interval containing I i−1 cannot use color i − 1. Therefore, the following two cases arise.   Our main interest in this paper is in deterministic algorithms. For the online case, we note that there is a randomized algorithm that uses O(log n) colors with high probability. This follows from the general technique of Bar-Noy et al. [1], who present an online algorithm for so-called k-degenerate hypergraphs that uses O(k log n) colors with high probability. A hypergraph H = (V, E) is called k-degenerate if for every subset V ⊆ V of vertices, and for every ordering v 1 , . . . , v i of V , the following holds: denotes the degree of v j in the Delaunay graph of H[v 1 , . . . , v j ] (the Delaunay graph of a hypergraph is the subhypergraph on all vertices containing exactly hyperedges of size 2). To apply their result it suffices to show that the hypergraph generated by intervals is 2-degenerate, which can be done using an amortized counting of the number of new Delaunay edges at each insertion as follows.
Let v 1 , . . . , v i be a sequence of intervals inserted in that order. Each time an interval is inserted, each endpoint p is labelled (or relabelled) 0, 1, or 2, depending if the region of the real line immediately to the right of p is covered by zero, one, or two or more intervals respectively. Now it suffice to notice two things: first, the label can only increase over time, second, each time a Delaunay edge appears, at least one endpoint label becomes 2 (either a 1 is turned into a 2, or one of the endpoints of the new interval is immediately labelled 2). Therefore, there cannot be more Delaunay edges created than the number of endpoints. Note that the rightmost endpoint is labelled 1 at the end of the insertions sequence, matching the nested lower bound.

Kinetic conflict-free colorings
In this section we consider conflict-free colorings of a set of intervals in R 1 whose endpoints move continuously. Note that we allow the endpoints of an interval to move independently, that is, we allow the intervals to expand or shrink over time. We show that by using only three recolorings per event-an event is when two endpoints cross each other-we can maintain a conflict-free coloring consisting of only four colors. Our recoloring strategy is based on the chain method discussed in the proof of Theorem 3.2(ii); see also Fig. 3. This method uses three colors: two colors for the chain and one dummy color. To be able to maintain the coloring in the kinetic setting without using many recolorings, we relax the chain properties and we allow ourselves three colors for the chain. Next we describe the invariants we maintain on the chain and its coloring, and we explain how to re-establish the invariants when two endpoints cross each other. In the remainder we assume that the endpoints of the chains are in general position except at events, and that events do not coincide (that is, we never have three coinciding endpoints and we never have two events at the same time). These conditions can be removed by using consistent tie-breaking.
The chain invariants. Let S be the set of intervals to be colored, where all interval endpoints are distinct. (Recall that we assumed this to be the case except at event times.) Consider a subset C ⊆ S and order the intervals in C according to their left endpoint. We denote the predecessor of an interval I ∈ C in this order by pred C (I), and we denote its successor by succ C (I). A chain (for S) is defined as a subset C with the following three properties.
(C1) Any interval I ∈ C can intersect only two other intervals in C, namely pred C (I) and succ C (I).
(C2) Any interval I ∈ S \ C is completely covered by the intervals in C.
(C3) No interval I ∈ C is fully contained in any other interval I ∈ S. Now consider a set S and a chain C for S. We maintain the following color invariant: each interval I ∈ C has a non-dummy color and this color is different from the color of succ C (I), and each interval in S \ C has the dummy color.
Lemma 5.1. Let S be a set of intervals and C be a chain for S. Then any coloring of S satisfying the color invariant is conflict-free.
Proof. Property (C2) implies that any point contained in at least one interval of S is contained in a chain interval. Furthermore, from property (C1) we know that any point x ∈ R 1 is contained in at most two intervals of C, and that if x is contained in two chain intervals they must be consecutive. The color invariant guarantees that two consecutive chain intervals have different colors, so the (at most two) chain intervals containing x provide a unique color for x. Hence, the coloring is conflict-free.
Handling events. Our kinetic coloring algorithm maintains a chain C for I and a coloring with three colors (excluding the dummy color) satisfying the color invariant. Later we show how to re-establish the color invariant at each event, but first we show how to update the chain by adding at most one interval to the chain and removing at most two. We distinguish several cases.
• Case A: The right endpoints of two intervals I and I cross.
Assume without loss of generality that I is shorter than I . We have two subcases.
-Subcase A.1: Interval I is contained in I before the event. In this case I was not a chain interval before the event. If after the event I is still fully covered by the chain intervals, then there is nothing to do: we can keep the same chain. Otherwise, property (C2) is violated after the event. We now proceed as follows. First we add I to the chain. If I intersects pred C (I )-note that I must be a chain interval if (C2) is violated-then we remove I from the chain.
-Subcase A.2: Interval I is contained in I after the event. If I was not a chain interval, there is nothing to do. Otherwise property (C3) no longer holds after the event, and we have to remove I from the chain. If I is also a chain interval then this suffices. Otherwise we add I to the chain, and remove pred C (I) if pred C (pred C (I)) intersects I .
• Case B: The left endpoints of two intervals I and I cross. This case is symmetric to Case A.
• Case C: The right endpoint of an interval I crosses the left endpoint of an interval I . Again we have two subcases.
-Subcase C.1: Intervals I and I start intersecting. Assume without loss of generality that I was to the left of I . Note that properties (C2) and (C3) still hold after the event. The only possible violation is in property (C1), namely when both I and I are chain intervals and there is a chain interval I with pred C (I ) = I and succ C (I ) = I . In this case we simply remove I from the chain.
-Subcase C.2: Intervals I and I stop intersecting. Assume without loss of generality that I is to the left of I after the event. First note that this cannot violate properties (C1) and (C3). The only possible violation is property (C2), namely when both I and I are chain intervals and there is at least one non-chain interval containing the common endpoint of I and I at the event. Of all such non-chain intervals, let I be the interval with the leftmost left endpoint. Note that I is not contained in any other interval, so we can add I to the chain without violating (C3). After adding I we check if we have to remove I and/or I : if I intersects pred C (I) then we remove I from the chain, and if I intersects succ C (I ) then we remove I from the chain.
It is easy to check that in each of these cases the new chain that we generate has the chain properties (C1)-(C3). Next we show that each case requires at most three recolorings and summarize the result. Figure 8: The gadget used to show that Ω(n 2 ) recolorings are sometimes necessary.
Lemma 5.2. In each of the above cases, the changes to the chain require at most three recolorings to re-establish the color invariant.
Proof. An interval that is a non-chain interval before and after the event need not be recolored. We have seen that we add at most one interval to the chain and remove at most two. Removing an interval from the chain requires recoloring it to the dummy color. Adding an interval requires giving it a color that is different from its predecessor and its successor in the chain, which we can do since we have three colors available for the chain. It remains to check if any other chain intervals need to be recolored. This can only happen in case C.1, when I and I are chain intervals that are not removed. In this case it suffices to recolor I with a color different from the color of I and from the color of pred C (I). In all cases, the number of recolorings is at most three.
The following theorem summarizes the result. Theorem 5.3. Let S be a kinetic set of intervals in R 1 . We can maintain a conflict-free coloring for S with four colors at the cost of at most three recolorings per event, where an event is when two interval endpoints cross each other.
A lower bound. Now consider the simple scenario where the intervals are rigid-each interval keeps the same length over time-and each interval is either stationary or moves with unit speed to the right. Our coloring algorithm may perform recolorings whenever two endpoints cross, which means that we do Θ(n 2 ) recolorings in total. We show that even in this simple setting, this bound is tight in the worst case if we use at most four colors.
Consider four intervals I 1 , I 2 , I 3 , I 4 where I i = (a i , b i ), with a i < b i as shown in Figure 8. Here I 2 ⊂ I 1 , I 4 ⊂ I 3 , the right endpoints of I 1 and I 2 are contained in I 3 ∩ I 4 , and the left endpoints of I 3 and I 4 are contained in I 1 ∩ I 2 . The exact locations of the endpoints with respect to each other is not important and we focus on the different overlap sets of the gadget. Specifically within a gadget there is a point contained in each of the following sets, Based on these sets we can show that no coloring for crossing gadgets exists that provides a valid conflict-free coloring for each combination of intersection sets between the two gadgets. The proof relies on the following lemma. Proof. We can assume that not both I 1 , I 2 , I 3 , I 4 and J 1 , J 2 , J 3 , J 4 use all four colors, otherwise G 4 ∪ H 4 = {I 1 , I 2 , I 3 , I 4 , J 1 , J 2 , J 3 , J 4 } is not conflict-free. It is also not possible to use at most two colors. Hence, suppose that there are exactly three colors among I 1 , I 2 , I 3 , I 4 (the other case is symmetric), say two are red, one is blue, and one is green. Then G 4 = {red, red, blue, green}, and without loss of generality, G 2 = {red, blue} and G 6 = {red, green}. We now have two cases.
2. Two intervals among J 1 , J 2 , J 3 , J 4 use yellow. It follows that H 4 contains two yellow intervals and the remaining two intervals are colored either {red, blue}, implying that G 2 ∪ H 4 is not conflict-free; or {red, green}, implying that G 6 ∪ H 4 is not conflict-free; or {blue, green}, implying that G 4 ∪ H 4 is not conflict-free. Now we place Ω(n) of these gadgets in two groups and for simplicity assume a gadget has width of 1. The gadgets in the first group are spaced with distance 2 between them, so a gadget from the second group can fit between any two consecutive gadgets. In the second group the gadgets are spaced with distance 3n between them, so that all gadgets of the first group fit between them. All gadgets of the first group then move at the same speed, starting somewhere to the left of the second group and moving to the right. The gadgets of the second group remain stationary. These motions ensure that each gadget of first group will cross each gadget of the second group, generating Ω(n 2 ) crossing events, each of which results in at least one recoloring by Lemma 5.4.
Theorem 5.5. For any n > 0, there is a set of 8n intervals, each of which is either stationary or moves with unit speed to the right, so that at least n 2 recolorings are required to maintain a conflict-free coloring at all times.

Conclusion
We introduced the dynamic conflict-free coloring problem, and obtained several results on this problem for conflict-free colorings of intervals with respect to points. Our main results include lower bounds on the number of recolorings needed to obtain a certain maximum number of colors, and algorithms that nearly achieve these bounds. We also showed that much better bounds are possible for the kinetic version of the problem.
An obvious open problem is to close the gap between our lower and upper bound. To improve the lower bounds one might exploit deletions; our current construction uses only insertions. On the upper-bound side, it would be interesting to see if the bounds for the case of a bounded universe can also be obtained in the general case. Another open problem is to obtain lower bounds on the expected behavior of randomized algorithms. Finally, it is interesting to study dynamic conflictfree colorings in R 2 .