Competitive Vertex Recoloring

Motivated by placement of jobs in physical machines, we introduce and analyze the problem of online recoloring, or online disengagement. In this problem, we are given a set of n weighted vertices and a k-coloring of the vertices (vertices represent jobs, and colors represent physical machines). Edges, representing conflicts between jobs, are inserted in an online fashion. After every edge insertion, the algorithm must output a proper k-coloring of the vertices. The cost of recoloring a vertex is the vertex’s weight. Our aim is to minimize the competitive ratio of the algorithm, i.e., the ratio between the cost paid by the online algorithm and the cost paid by an optimal, offline algorithm. We consider a couple of polynomially-solvable coloring variants. Specifically, for 2-coloring bipartite graphs we present an O(logn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(\log n)$$\end{document}-competitive deterministic algorithm and an Ω(logn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Omega (\log n)$$\end{document} lower bound on the competitive ratio of randomized algorithms. For (Δ+1)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(\Delta +1)$$\end{document}-coloring, where Δ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Delta $$\end{document} is the maximal node degree, we present tight bounds of Θ(Δ)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Theta (\Delta )$$\end{document} and Θ(logΔ)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Theta (\log \Delta )$$\end{document} on the competitive ratios of deterministic and randomized algorithms, respectively (where Δ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Delta $$\end{document} denotes the maximum degree). We also consider the fully dynamic case which allows edge deletions as well as insertions. All our algorithms are applicable to the case where vertices are arbitrarily weighted, and all our lower bounds hold even in the uniform weights (unweighted) case.


Introduction
The following situation is not uncommon in server farms, such as a data center of a cloud provider: Jobs (or virtual machines) are created and located at various physical machines, and then it turns out that some of the jobs cannot co-exist on the same machine. Such restrictions may be due to various reasons, e.g., conflicting resource requirements, security considerations etc. (cloud providers allow users to express these constraints using so-called "anti-affinity rules:" see, e.g., [1]). When such a conflict arises between co-located jobs, at least one of these jobs must migrate to another machine, at a cost. Motivated by such scenarios, in this we introduce and study the Disengagement Problem, in which disengagement (anti-affinity) requests arrive online, and the goal is to minimize the overall cost of job migrations.
More specifically, we abstract the problem as follows (more details in Sect. 2). We view the problem as an online graph coloring problem with recourse. Initially, we are given a vertex-weighted graph G 0 = (V , ∅) of n isolated vertices, and a coloring c 0 : V → [k], where k ∈ N is a given parameter. 1 (Vertices correspond to jobs and colors correspond to machines.) The input is a sequence of edges e 1 , e 2 , . . ., that arrive one at a step. After each step i, we are required to output a new proper vertex coloring c i : V → [k] such that under c i , no edge in e 1 , . . . , e i is monochromatic. The cost of a given sequence of colorings c 0 , c 1 , . . . is the total weight of recolorings, i.e., the sum, over all vertices, of vertex weight times the number of times that vertex was recolored. Due to this formalization, in this paper we refer to the problem interchangeably as Vertex Recoloring or Disengagement.
We note that in many cases, disengagement restrictions are temporary. We refer to this setting as "fully-dynamic disengagement," as opposed to "partially-dynamic disengagement", in which edges are only added, and never removed. In this work, we mainly focus on the partially-dynamic variant.
Our Results We study online disengagement from the competitive analysis viewpoint [16]. That is, an algorithm for online disengagement is said to be c-competitive for some c ≥ 1 if the following holds: given any instance, the recoloring cost of the algorithm is at most c times that of the optimal offline algorithm. (Note that an optimal offline solution never recolors a vertex more than once.) Since vertex coloring is a hard problem [18], we focus on two cases which are polynomially solvable, namely 2-colorable graphs and ( + 1)-coloring, where denotes the maximum vertex degree.
1. For 2-coloring, we give a deterministic, O(log n)-competitive algorithm. We also show a matching lower bound of (log n) on the competitiveness of randomized algorithms. 2. For ( + 1)-coloring, we present: • A deterministic, O( )-competitive algorithm, and a matching ( ) lower bound. • A randomized, O(log )-competitive algorithm, and a matching (log ) lower bound.
In Sect. 5.1, we give general lower bounds for the disengagement problem on a graph of n nodes with k colors: we show an (k log n k ) lower bound for deterministic algorithms, and an (log k log n k ) lower bound for randomized algorithms. We also briefly mention capacitated disengagement in Sect. 5.2, wherein there is a restriction upon the total weight that can be assigned to each color. If the total permissible weight (across all colors) equals the total vertex weight, we show a deterministic competitive ratio lower bound of (n), and a randomized lower bound of (log(n)).
In all the above cases, our algorithms work with weighted vertices, and our lower bounds apply even to unweighted instances.
We discuss the variant of fully-dynamic online disengagement, in which conflicts are temporary, as opposed to the partially-dynamic disengagement in which conflicts never disappear (see formalization in Sect. 2). It turns out that fully-dynamic disengagement is substantially harder than partially-dynamic disengagement. More specifically, even though in this case the offline cost is not bounded by n, all lower bounds of the partially-dynamic case apply as well. We also show that the special case of fullydynamic disengagement with two colors on an odd cycle (which of course is not 2-colorable in the partially-dynamic case) is at least as hard as a certain metrical task system on an odd cycle, and hence admits a lower bound of (n)-competitiveness for deterministic algorithms (whereas the partially-dynamic problem on even cycles is solvable by an O(log n)-competitive deterministic algorithm).
Our Techniques For the bipartite (2-coloring) problem, our algorithm maintains a partition of the vertices into connected components. Since there are two colors, each connected component has exactly two legal colorings. When two components merge due to the arrival of a monochromatic edge, the algorithm must choose between the two legal colorings for that new component, where each coloring implies recoloring one of the joined components. There are two natural heuristics for choosing which component to recolor. The greedy approach is to recolor the lighter component; another approach, with an eye to the offline solution (which, knowing all future edges, recolors every vertex at most once), is to recolor so as to minimize the change from the initial coloring of the graph (as measured in weighted Hamming distance). However, it is not hard to see that each of these algorithms has (n) competitive ratio (cf. Sect. 3.1). Fortunately, it turns out that by a careful combination of these two noncompetitive approaches (using amortized analysis), we can obtain an O(log n)-competitive deterministic algorithm.
For ( + 1)-coloring, the key observation is that vertices that are recolored by the optimal algorithm must be incident on all edges which are monochromatic by their initial coloring. Therefore, our algorithm maintains a vertex cover of the edges which are monochromatic by their initial coloring. In our algorithm, upon the arrival of an edge, only vertices in that vertex cover are allowed to change their color. This way, we limit the set of vertices that change their color. Coupling this with an upper bound on the total number of recolorings which a vertex undergoes (using ), we can prove a bound on the competitive ratio. Specifically, we maintain a 2-approximate weighted vertex cover using the primal-dual (local ratio) 2-competitive algorithm; when a monochromatic edge arrives, an appropriate vertex from the vertex cover is recolored by a color not taken by any of its neighbors. In the deterministic case, which achieves O( )-competitiveness, the new color is an arbitrary available color, and in the randomized case, the new color is a random (uniformly chosen) available color. In the latter case, some subtle probabilistic analysis shows O(log )-competitiveness.
Related Work We do not know of previous work on competitive recoloring of vertices: some considered recoloring, some considered competitive coloring, but this is the first work to consider both simultaneously. We review some relevant results below.
Competitive Coloring Let us start with competitive coloring. Work on online vertex coloring, starting with the paper of Lovász et al. [15], assume that vertices arrive one by one, each vertex with all its incident edges. When a vertex arrives it must be assigned a color irrevocably, maintaining a legal vertex coloring at all times. The goal is to minimize the number of colors used by the algorithm. It is known that the competitive ratio in this case is (n/ log n) [10,11].
Dynamic Algorithms for Recoloring Recoloring has been considered in the dynamic data structures setting, in which one seeks to maintain a proper coloring while minimizing the number of recolorings per vertex/edge update (arrival or departure); see, e.g., [5,8,14,17]. This model differs from ours in that we do not measure costs w.r.t. the number of steps, but w.r.t. an optimal recoloring algorithm opt for the input sequence. In particular, when opt T , where T is the length of the input sequence, we remain competitive against opt (rather than T ); however, in dynamic recoloring (or recoloring with recourse), a constant number of recolorings per edge arrival results in (T ) cost.
For general graphs, coloring a graph using a competitively-small palette (w.r.t. its chromatic number) is NP-hard; thus, restricting the set of graphs or their chromatic number is necessary for polynomial running time. This is the case for the work of Kashyop et al. [14] (which focuses on bipartite graphs, max-degree bounded graphs, and graphs with bounded arboricity), and Bosek et al. [8] (which focuses on interval graphs). Indeed, our work also focuses on coloring problems which can be tackled in polynomial time, namely 2-coloring and ( + 1)-coloring. However, one can also consider coloring in general graphs, using an (exponential time) oracle for graph coloring. This is the case for the works of Barba et al. [5] and Solomon and Wein [17]. The best current result, due to [17], is a deterministic algorithm that maintains a coloring which is O( log 3 n d )-competitive with respect to the number of colors (against the graph's chromatic number), while using O(d) amortized recolorings per update, where d is a free parameter (allowing randomization improves this result slightly). Henzinger et al. [13] give better results for bounded arboricity graphs.
Dynamic Graph Partitioning A problem closely related to online disengagement is "dynamic balanced graph partitioning," introduced by Avin et al. [2,3]. In this problem vertices are located in finite-capacity clusters (servers), and communication requests arrive online. Communication between vertices incurs cost unless the vertices are located in the same cluster. Vertices can migrate to other clusters, at a (larger) cost, and the algorithm is required to find a placement of the vertices in clusters at each step. The goal is to minimize cost, and the overall measure is the competitive ratio, possibly with resource augmentation (i.e., assuming that the capacity available to the algorithm is larger than the capacity available to the adversary). Intuitively, this problem is the flip side of disengagement: In partition, requests are to collocate vertices (subject to capacity constraints), whereas in disengagement, requests are to separate them. In [3], the fully-dynamic variant of the partition problem is considered, where collocation requests are temporary: a pair of vertices may be collocated by a request and later separated. It is shown in [3] that the competitive ratio of deterministic algorithms for the dynamic case is O(k log k) and (k), where k is the capacity of a cluster (both bounds allow for resource augmentation). Recently, the partially-dynamic variant of the partition problem was considered, in which it is guaranteed that there exists a feasible placement of the vertices to clusters so that all communication is local (i.e., occurs within a cluster). In [12], tight bounds on the competitive ratios of deterministic and randomized algorithms for partially-dynamic partition are given: ( log W ) and (log + log W ), respectively, where is the number of servers and W is the server capacity.
Paper Organization The remainder of this paper is organized as follows. In Sect. 2 we formalize the model and introduce some notation. In Sect. 3 we study the bipartite case. In Sect. 4 we study ( + 1)-disengagement. In Sect. 5 we prove a general lower bound for recoloring using k colors, and also discuss the capacitated case. In Sect. 6 we consider fully-dynamic disengagement. We conclude in Sect. 7 with a few open problems.

Model and Notation
Preliminaries Given a natural number k, we use [k] to denote {1, 2, . . . , k}. In this paper we are concerned with colorings of vertices in graphs. Given an undirected simple graph G = (V , E), a proper k-coloring of G is an assignment c : We shall use the following definition extensively.
Problem Statement In this paper, we study the following problem.
Online Disengagement (Vertex Recoloring) Initial Input: We use E i = {e 1 , e 2 , . . . , e i } to denote the set of edges that have arrived up to and including the ith step, and we use G i = (V , E i ) to denote the known graph after step i.
Note that in Online Disengagement, as is the case for any partially-dynamic graph problem, the input sequence length can be assumed to be finite without loss of generality, as there are only n 2 possible distinct edges connecting vertices of V . Special Cases In this paper we consider some special cases of online disengagement. The variants we consider are the following.
• In Unweighted Online Disengagement, all vertices have weight 1.
• In Bipartite Online Disengagement, we are guaranteed that the input graph is 2-colorable. • In ( + 1) Online Disengagement, we are guaranteed that the maximum degree of the input graph does not exceed , and the available number of colors is + 1.

Capacitated Disengagement
In Sect. 5.2 we consider capcitated disengagement, in which each color i ∈ [k] has a capacity W i > 0, and the total weight of vertices colored i must not exceed W i .

Fully-dynamic Disengagement
Online disengagement, as stated above, is called partially dynamic, in the sense that edges only arrive and never leave. However, in some cases, the presence of edges restricting the solution may be temporary. In the fully-dynamic online disengagement variant, edges may leave too. The input and the output to the problem, as well as the cost measure, are the same, but the feasibility requirement is different: The coloring output by the algorithm after each step need be a proper coloring for

Bipartite Disengagement
In this section we consider disengagement for bipartite graphs and k = 2. In other words, we are promised that the final graph G (and hence every intermediate graph) is 2-colorable, and the requirement is to find, at each step, a legal 2-coloring, while minimizing the overall cost.
Note that this case is stricter than ( + 1)-disengagement, since the maximum degree is typically large (the case = 1 is trivial). Indeed, we show in this section that the competitive ratio in this case is (log n). We start with an O(log n)competitive deterministic algorithm for the weighted case, and then prove an (log n) lower bound on the competitive ratio of any (randomized) algorithm that holds even in the unweighted case.

Simple Approaches
Any algorithm for 2-coloring maintains, throughout its execution, the partition of the nodes into connected components. Since there are only 2 colors, each connected component has two possible proper colorings. Whenever two components are joined by a new edge, if their colorings agree (i.e. the two ends of the arriving edge are colored differently), the algorithm may output the previous coloring unaltered. Otherwise, when the edge is monochromatic, the algorithm must decide which of the two colorings is adopted by the newly created component: each coloring implies recoloring all nodes in one of the components being joined. There are two natural approaches one can consider. One approach we call "greedy" is to recolor the component of the smaller weight; another approach we call "conservative" is to choose the colorings which is closer to the initial coloring. Both approaches are not competitive, as we show below. For convenience, we refer to the two colors as red and blue.
The Greedy Algorithm First, consider the algorithm that always flips the color of the smaller component (weight-wise). Assume without loss of generality that we have at least two nodes initially colored red, and consider an input sequence of a connected component in the form of a double star: 1. Create an edge between two arbitrary red nodes. The node that stays red becomes the red hub, and the other one becomes the blue hub. 2. Do until there are no isolated nodes: (a) Let v be some isolated node. (b) Create a monochromatic edge between v and its matching hub.
Every isolated node is a component of size 1. When it is connected via an edge to the component of the hubs (which is at least of size 2) the algorithm flips its color. In fact, the online algorithm flips the color of every node in the graph except for the red hub (paying a cost of n − 1), while the optimal algorithm only chooses the other coloring for the two hubs, paying a cost of 1. We conclude that the competitive ratio of the greedy algorithm is (n).
The Conservative Algorithm Consider now the algorithm which always prefers the coloring that is closer (i.e, smaller Hamming distance) to the initial coloring. Assume w.l.o.g. that initially, at least half of the nodes are red. Now, we subject it to the following input sequence, which creates a connected component in the form of a chain: 1. Create an edge between two red nodes 2. Do until there are no isolated red nodes: (a) Let v be some red, isolated node. (b) If one of the chain end-nodes u is red, create an edge (u, v). (c) Otherwise, create an edge between v and any of the chain end-nodes The chain grows by one node each iteration; in half of the iterations is has an equal number of blue and red nodes. When that happens, the following holds: 1. One of the chain end-nodes is red (since the chain is of even length) 2. Flipping the colors of all of the nodes in the chain does not increase the distance from the initial coloring Therefore, in every even iteration, a new edge connects two red nodes, to which the algorithm responds by flipping the color of every node in the chain. Overall, the algorithm pays a cost of (n 2 ), while an optimal algorithm colors at most half of the nodes exactly once, or a cost of O(n). It follows that the competitive ratio of the conservative algorithm is (n) as well.

Algorithm 1 Recoloring for bipartite graphs, invoked upon arrival of edge
// otherwise, u and v belong in different components 4: Let S 1 , S 2 be the components of u and v in G i−1 , and let S be their common component in G i 5: Let w(S i ) be the sum of the weights of the nodes in the set S i 6: Define colorings γ 1 and γ 2 by flipping the colors of components S 1 and S 2 , respectively, i.e., for all z ∈ V :

A Competitive Algorithm
While each approach discussed in Sect. 3.1 resulted in (n) competitive ratio, the following combination of them is O(log n)-competitive: If one of the two possible coloring is such that at least two-thirds of the weighted nodes will have their original color c 0 (and therefore that coloring has less than half the Hamming distance to the original coloring than the alternative), that alternative is chosen by the algorithm. Otherwise, no coloring has a significantly smaller Hamming distance, and in this case the algorithm prefers the "cheaper" coloring, i.e., the algorithm recolors the component with the smaller weight.
Pseudocode of the algorithm to be executed upon the arrival of a new edge e i is given in Algorithm 1. For a subset of nodes V , we use c V to denote the restriction of the coloring c to the set of nodes V . For convenience, we write δ(c) as a shorthand for δ H (c, c 0 ). We also use δ(c V ) to refer to δ H (c V , c 0 V ), i.e. the weighted Hamming distance between the coloring c and the initial coloring c 0 restricted to the set of nodes V .
We consider the partition of V into connected components. Let P i be the set of connected components after the arrival of e i , and define P 0 = {{v} | v ∈ V }. Note that in the bipartite case, the color of one node determines the coloring of all nodes in its connected component. Therefore, if e i is monochromatic upon arrival, it necessarily connects two connected components S 1 , S 2 ∈ P i−1 into a new component S (cf. line 4).
We now analyze the algorithm. Specifically, we prove the following theorem.
Fix an input sequence {e i } i and an optimal coloring c * , i.e., δ(c * ) is minimal among all legal colorings of the final graph G. Denote r := δ(c * ), and let alg denote the cost of Algorithm 1 on the given input sequence. We prove the theorem by showing that alg ≤ O(r log r ).
We start by showing that if a component is not colored by the optimum solution and the algorithm in the same way, then the optimum solution recolors a significant part of the component. We introduce some additional terminology.
• Given a connected component S and a coloring c, we say that S is well colored by

Proposition 3.2 For all i and all S ∈ P i , if S is badly colored then w(S) < 3w(S ∩ R).
Proof We prove the claim by induction on i, the number of edges inserted. For i = 0 we have that P 0 is a collection of singletons. Let S = {v} ∈ P 0 . If S is badly colored then by definitions, v ∈ R, and hence S ∩ R = S, proving the base case. Assume now that the claim holds for all components in P i−1 . It suffices to show that if a new component is created by the arrival of edge e i = (v 1 , v 2 ), the claim holds for that component. So assume that S is created by merging S 1 , , then c i = c i−1 , and thus the component S is badly colored iff the components S 1 , S 2 are both badly-colored (note that it cannot be that only one is badly colored, since that would imply the infeasibility of c * ). Using the induction hypothesis, if S is badly colored then completing the proof for the case that . When the component S is formed, the algorithm considers the two colorings γ 1 and γ 2 for S, where γ 1 and γ 2 are formed from c i−1 by recoloring S 1 and S 2 , respectively. Thus, the colorings of S under γ 1 and γ 2 are negations of one another. One of these colorings, wlog γ 1 , is consistent with c * , and thus δ( If the component S is badly colored, it must be that γ 2 is chosen. For this to happen, it must hold that δ(γ 2 S ) < 2δ(γ 1 S ). Simplifying, we get w (S) < 3w (S ∩ R), completing the proof.  Proof Clearly, the total weight of nodes in R which change color during the algorithm is at most w(R) = r . It remains to bound the weight of nodes that change color in V \ R; denote the set of those nodes by U .
Let B ⊆ 2 V be the collection of subsets of V which were badly-colored components in the algorithm at some point. We claim that B is a laminar collection -that is, for every two components S 1 , Indeed, B is laminar since it is contained in the collection of all connected components which are formed in the algorithm, which is itself laminar.
Since B is a laminar collection, there exists a subcollection B ⊆ B of disjoint components such that S∈B S = S∈B S.
Consider any node v ∈ U . The coloring c * is consistent with c 0 on this node v; thus, for this node to change color during the algorithm, it must be part of some badly-colored component at some point during the algorithm. This implies that U ⊆ Next, we define a potential function φ such that φ(i) = 6δ(c i ). Note that φ(0) = 0, and that φ is nonnegative. Following the conventional notation, denote For every i ∈ N, let alg i be the cost incurred by the algorithm in step i, i.e., δ H (c i , c i−1 ). Define Then we have where the last inequality uses the fact that changing the coloring of nodes of total weight s increases the coloring's weighted Hamming distance from c 0 by at most s, and thus increases φ by at most 6s.

Proposition 3.5
If v ∈ V is recolored in step i ∈ I + , then the weight of the connected component of v grows by a factor of at least 5 4 in step i. That is, denoting by S, S the old and new components of v respectively, it holds that w S ≥ 5 4 w (S).

Proof
Node v changes color when some components S 1 , S 2 ∈ P i−1 are merged to form S ∈ P i , and one of these components, wlog S 2 , changes color, where v ∈ S 2 . We now must show that w (S) ≥ 5 4 w (S 2 ). Denote by γ 1 and γ 2 the colorings formed from c i−1 by recoloring S 1 and S 2 respectively; since S 2 is recolored, the algorithm chose γ 2 .
Proof of Theorem 3.1 By Eq. (1), it is enough to bound 7 i∈I + alg i . Consider any step i in which some component S ∈ P i−1 is recolored, upon being connected to 2n . It holds that w (W ) ≤ n · w(S) 2n = w(S) 2 , and thus w (S) ≤ 2w (S \ W ). Therefore, Plugging Eq. (4) into Eq. (1), and denoting by S i ∈ P i−1 the component that was recolored in step i, it thus remains only to bound the term Using Lemma 3.4, and denoting by U the set of nodes recolored by the algorithm, we know that w (U ) ≤ 3r . Consider a node u ∈ U : each time the node u is recolored in a step from I + , the weight of the component containing u grows by a factor of at least 5 4 (by Proposition 3.5). Thus, each node can be recolored in steps from I + at most O(log n) times before the weight of u's component exceeds 2n · w (u). This implies that the term in Eq. (5) can be bounded by O(log n) · w (U ) = O(log n) · r , and thus alg ≤ O(log n) · r , completing the proof.

A Lower Bound
We present a general lower bound in the unweighted case. We note that a similar argument is used in [14] by Kashyop et al., where it is shown in the context of data structures that any deterministic algorithm that maintains a 2-coloring must perform, in the worst case, t edge insertion require (t log t) recolorings. Proof Assume w.l.o.g. that n is a power of 2 (otherwise, we work only with 2 log n nodes, leaving the others isolated). We construct an input sequence in log n phases, while maintaining the following invariant: After each phase h: (i) there are n/2 h connected components, and (ii) each connected component is a chain of 2 h nodes.
Clearly, the invariant holds before the execution begins, when there are n isolated nodes. Note that we allow for any initial coloring.
In each phase h, for h = 1, . . . , log n, we connect segments in pairs by introducing n/2 h edges: each edge connects random endpoints of two segments (this is the only randomization we use). This obviously maintains the invariant after phase h is completed.
Consider phase h for h > 1. The merging segments are of even length 2 h−1 each, and hence each segment has exactly one endpoint of each color. It follows that by construction, each new edge is monochromatic with probability 1/2. Therefore the expected cost incurred in phase h > 1 for any deterministic algorithm is because in phase h there are n/2 h merges, and each merge has expected cost 1 2 · 2 h−1 . In summary, the cost of any deterministic algorithm on a random instance defined as above, over all phases, is at least (log n − 1) · n/4 = (n log n) (the cost of phase 1 depends on the initial coloring). On the other hand, the optimal cost for any n-node graph is never more than n: every node needs to be colored at most once, according to the final graph. The result follows.

(1+1) Disengagement
In this section we consider ( + 1)-coloring, where is an upper bound on the number of neighbors a node may have. We show that in this case, the competitive ratio of deterministic disengagement is ( ) and that the randomized competitive ratio is (log ).

Algorithms
We now present our algorithms for the + 1 disengagement problem. Algorithm 2 is used in both the deterministic and randomized versions: The only difference is the implementation of the "recolor" subroutine it invokes (Algorithms 3 and 4). To see how the algorithm works, let us define an auxiliary graph G i = (V , E i ) as follows: i.e., the auxiliary graph G i includes only edges that connect nodes with the same initial color. The underlying idea of Algorithm 2 is to maintain a small-weight vertex cover of G , denoted C, and apply recoloring only to nodes in C. (It turns out that there is no need to remember the initial coloring.) For a deterministic algorithm, we recolor using the procedure given in Algorithm 3: change the node's color to the first available color, where a color is said to be available if it is not taken by any neighbor. For a randomized algorithm, we choose uniformly at random among the available colors (Algorithm 4).
To maintain a light vertex cover, we use the classical 2-approximation algorithm of Bar-Yehuda and Even [4] (we can use any other algorithm which processes edges one at a time). Whenever an uncovered edge is considered, the residual weights of its endpoints are reduced by the same amount so that one of them reaches zero. The node with residual weight 0 (possibly both) is then added to C. We first analyze the general framework of Algorithm 2.

Lemma 4.2 After every step, C is a vertex cover of G . Moreover, w(C) is at most twice the weight of any vertex cover of G .
Proof We first argue that C is a vertex cover of G . Let e i = (u, v) ∈ E . We consider two cases. If e i is monochromatic upon arrival, then Algorithm 2 makes sure that if none of its endpoints are in C, then at least one of them enters C (lines [8][9][10][11][12][13][14][15][16][17][18], so e i is covered by C in this case. If c i (u) = c 0 (u), then node u was necessarily recolored at some point in the past. However, since Algorithm 2 recolors only nodes in C, we must have u ∈ C, so e i is covered by C in this case too. Finally, the approximation bound of w(C) follows from [4].

Lemma 4.3 Every algorithm pays a cost of at least w(C)/2.
Proof Consider any solution to the given input. The edges in E are monochromatic by the initial coloring, so every disengagement algorithm has to recolor at least one endpoint of every edge in E at least once. Therefore, the set of nodes recolored by any solution is a vertex cover of G . The result follows now from Lemma 4.2.
We now consider the way recoloring is done. First, the deterministic version.

Lemma 4.4 Algorithm 2 with Algorithm 3 pays at most · w(C).
Proof By the code, Algorithm 2 recolors only nodes in C. Observe that a node may be recolored only when a new incident edge is introduced. Since the maximum degree of a node is , the result follows.

Lemma 4.5 The expected cost of Algorithm 2 with Algorithm 4 is at most H · w(C)
Algorithm 3 recolor(u): recolor node u with the first available color

Proposition 4.6 Consider any two distinct nonadjacent nodes u, v ∈ C. At any iteration, it holds that
Proof Let w ∈ {u, v} be the node that changed its color last (since both u, v ∈ C, they both changed colors so w is always defined). It holds that: Let A v denote the event that w = v, and assume that A v holds. Let t denote the last iteration in which v changed its color, and let deg (v) be its degree at time t . Then v chose its color uniformly at random from a set of available colors S whose size is at least Thus:

Proposition 4.7 Consider any two nonadjacent nodes v ∈ C and u / ∈ C. At any iteration, it holds that
Proof The proof is similar to that of Proposition 4.6. Observe the last iteration in which v had changed its color, and denote its degree at that iteration as deg (v).
At that time, v chose a random color from a set S of available colors, such that . Additionally, since u / ∈ C, it has its initial coloring c(u) = c 0 (u). Therefore: where the second inequality is due to the fact that Pr(c v = c u | S = S ) equals 0 if c(u) / ∈ S and equals 1 |S | otherwise.

Proof of Lemma 4.5
Fix the input sequence. Let X be a random variable representing the overall cost of running the algorithm, and let X v be a random variable representing the cost incurred by recoloring a given node v ∈ V . We bound E[X v ].
Since Algorithm 2 recolors only the nodes in C, be the subsequence of input edges incident on v. Let X v j denote the expected cost of recoloring v due to edge e v j . We bound E[X v j ] as follows. Suppose that v is recolored for the first time when e j 0 is input (if none exists, we are trivially done). Then for • If u / ∈ C, then v changes its color w.p ≤ 1 +1− j (according to Proposition 4.7) • If u ∈ C and j < deg(u), then v does not change its color • If u ∈ C and j ≥ deg(u), then v changes its color w.p ≤ 1 +1− j (according to Proposition 4.6) Therefore, the expected cost incurred by v due to e v j is at most w(v) +1− j . It follows that the expected cost incurred by the recoloring of node v ∈ C is at most We can therefore summarize that the expected cost due to all nodes is at most We note that our deterministic algorithm does not require knowledge of , but the randomized one does.

Lower Bounds for (1 + 1)-Recoloring
We now state lower bounds on the competitive ratios of deterministic and randomized algorithms for ( +1)-recoloring. We prove the lower bounds in unweighted instances, i.e., the weight of each node is one. We start with a deterministic lower bound.

Theorem 4.8
The competitive ratio of any deterministic algorithm solving ( + 1)recoloring is ( ), for any initial coloring.
We need the following lemma.

Lemma 4.9 The optimal algorithm's cost after the i-th step is at most the number of non-isolated nodes in
Proof Since edges are constantly added to the graph G i , any coloring that is proper for G i is also proper for G j , where j ≤ i. The optimal offline algorithm can color G i greedily using + 1 colors, and use this coloring until the i-th step. Since every node is recolored at most one time, and the optimal algorithm might only recolor the non-isolated nodes, its cost is at most the number of such nodes.

Proof of Theorem 4.8
Let a deterministic algorithm be given. We construct an input sequence in phases as follows. First we choose a set of some + 2 nodes, denoted V . Note that since |V | > + 1, according to the pigeonhole principle, there must be at least two nodes u, v ∈ V with the same color. We then proceed in phases, where each phase is described as follows.
1. Do until ∃v ∈ V with deg(v) = : Note that the number of phases can be as large as we wish, since it is bounded only by the number of nodes, regardless of k and . Consider the cost of the online algorithm. Every new edge is monochromatic, so it pays a cost of 1 for each new edge. After s phases, at least s nodes have left V , each with a degree of . It follows that the cost of the online algorithm for s phases is at least s · /2 (since every edge could be counted twice).
On the other hand, by Lemma 4.9, the optimal cost is no more than the number of non-isolated nodes. This number is bounded by the number of nodes that ever were in V , and hence, in s phases, it is at most 2s + + 2: at most 2s nodes were removed from V , and at most + 2 nodes are in V after s phases. It follows that for s phases, the competitive ratio of any deterministic algorithm is ( ).
Intuitively, in the ( ) lower-bound proof, both Online and Offline always have to pay (a cost of at least 1) when the new edge creates a new connected component (of size 2), since it involves two nodes that still have their initial coloring. However, the Offline algorithm does not have to pay when the edge is incident on a node that Offline had already changed. We now present a lower bound for randomized algorithms.

Theorem 4.10
The competitive ratio of any randomized algorithm for ( +1)-coloring is (log( )), assuming that in the initial coloring there are at least two nodes of each color.
Proof Let A(I ) be the cost of algorithm A on an instance (input sequence) I . According to Yao's principle, if there is an instance distribution, for which the expected cost of every deterministic algorithm A is E[A(I )] ≥ L, then for every randomized algorithm there exists an instance I such that the algorithm's expected cost on I is at least L. We construct a distribution over input sequences as follows. First we pick a random permutation σ : [ + 1] → [ + 1] of the colors. We then introduce the edges in phases as follows. In the first phase we pick two nodes v 0 , v 1 ∈ V of color σ (1) and connect them with an edge. In each subsequent phase i, i ≥ 2, we pick a node v i of color σ (i) and connect it to all nodes v 0 , . . . , v i−1 . Clearly, after phase i, the input edges constitute a clique over v 0 , v 1 , . . . , v i . After phase we stop (we can repeat the construction with a fresh set of + 1 isolated nodes).
For the cost analysis, let C i denote the set of colors used by nodes v 0 , . . . , v i after phase i. Clearly |C i | = i + 1. In particular, for any deterministic algorithm, there exists at least one color c * i ∈ C i \ {σ (1), . . . , σ (i)}. Consider now the node v i+1 , added in phase i + 1. Its color is σ (i + 1), which is uniformly distributed over [ + 1] \ {σ (1), . . . , σ (i)}, and hence Pr[σ (i + 1) = c * i ] = 1 +1−i . It follows that the expected number of monochromatic edges (which is the expected cost of the deterministic algorithm) in phase i + 1 is at least 1 +1−i . Also by construction, the number of monochromatic edges in the first phase is 1. Therefore, the total expected cost across all phases is where H n denotes the nth harmonic sum. On the other hand, an optimal algorithm would pay a cost of 1 by recoloring only a single node in the first iteration with the single color that is never used, namely color σ ( + 1).
NP-hard in general, the lower bound presented in Sect. 5.1 holds for a particular family of easily-colorable graphs. In Sect. 5.2 we briefly discuss the capacitated case, in which each machine (i.e, color) has a limited capacity, and provide a lower bound for the tight case, wherein the total (color) capacity equals the total (node) weight.

General Lower Bound
Theorem 5. 1 The competitive ratio of recoloring n nodes with k colors is (k log(n/k)) for deterministic algorithms and (log k · log(n/k)) for randomized algorithms.
Proof We use a single framework, with unweighted graphs, for both the deterministic and the randomized case. We assume that n ≥ 3k. No generality is lost: If n < 3k, the claimed bounds follow from Theorems 4.8 and 4.10, by using only k nodes and leaving the others isolated (the case k > n is equivalent to k = n).
Assume further that n/k = 2 M for some integer M (otherwise, define n = k · 2 log(n/k) and use n instead of n).
In the construction, we use k-cliques, i.e., fully-connected graphs of k nodes. We say that two k-cliques K 1 , K 2 are aligned in edge set E if for every node u 1 ∈ K 1 , there is exactly one node u 2 ∈ K 2 such that (u 1 , u 2 ) / ∈ E. Such nodes are called partners. We use the term K -chain of length d to refer to a sequence of d aligned k-cliques. Given a node u in a k-chain, partner(u) denotes the set of nodes that are partners of u, including u. We note the following immediate fact for any k-chain Z .
• Any proper coloring c of Z satisfies, for all nodes u, v ∈ Z : if v ∈ partner(u) then c(u) = c(v).
We now describe the construction in phases. First there is a setup phase (phase 0), in which n k k 2 = n(k − 1)/2 edges are introduced to create n/k disjoint k-cliques. Next we run M = log(n/k) phases, such that the following invariant holds. To maintain the invariant, in each phase m ≥ 1 we group the k-chains in pairs and "stitch" each pair of k-chains to obtain k-chains of double length: we do that by selecting an extreme k-clique from each k-chain and introducing k(k − 1) edges, that connect each node in these k-cliques to k − 1 nodes of the other k-clique.
More specifically, let u 1 1 , . . . , u 1 k denote the nodes of a k-clique which is the end clique in one of the k-chains, and let u 2 1 , . . . , u 2 k denote the nodes of a clique at the endpoint of the other k-chain. The goal of stitching is to make these cliques aligned while making any online algorithm pay as much as possible. The way stitching is implemented, described next, is the only difference between the deterministic and the randomized cases.
Deterministic Stitching. We proceed node by node. We connect u 1 1 to a node u 2 j 1 such that c(u 1 1 ) = c(u 2 j 1 ). As a result, at least one of these nodes (and all its partners) changes its color. Since the algorithm is deterministic, the new coloring c can be computed. We then connect u 1 1 to a node u 2 j 2 such that c (u 1 1 ) = c (u 2 j 2 ). We continue this way, connecting u 1 1 to k − 1 nodes. We then proceed to u 1 2 , again connecting it to a node of the same color in each step. However, for u 1 2 we do that only k − 2 times, since the color of u 1 1 and its partner will never appear in the sequence. We complete the edges of u 1 2 by connecting it to the partner of u 1 1 . In general, for node u 1 j , we introduce k − j edges that connect it to nodes of the same color (at the time the edges arrive), and then edges that connect u 1 j to the partners of u 1 1 , . . . , u 1 j−1 . Randomized Stitching. This case is simpler to describe: For each node u 1 j in the first k-clique we pick a random permutation σ j : [k] → [k], and we introduce the following k − 1 edges: This concludes the description of randomized stitching. In both cases of stitching, the final graph is a k-chain of length n/k. Note that this graph is easily colorable using k colors: pick any k-clique K , assign the k colors to the nodes of K arbitrarily in a 1-1 fashion, and then color each remaining node by the color of its partner in K . Clearly, this can be done off-line at cost at most n.
In Lemma 5.3 below we show that for deterministic algorithms, the cost of every phase m = 1, . . . , M is at least n(k − 1)/4, for a total cost of at least Mn(k − 1)/4 = (nk log(n/k)). In Lemma 5.4 below we show that for randomized algorithms, the expected cost of every phase m = 1, . . . , M is at least 1 4 n H k/2 , for total expected cost of at least 1 4 Mn H k/2 = (n log k log(n/k)). Since the optimal cost is at most n, the result follows. Proof We use Yao's principle. The distribution of the input instances is defined in the specification of the phases. It therefore suffices to bound from below the expected cost of phase m for any deterministic algorithm. Consider the edges added for node u 1 j , and let us focus on edge (u 1 j , u 2 σ j (l) ), for some l ∈ [1, k − j]. The color of one of its endpoints is deterministic, given σ j (1), . . . , σ j (l − 1), and the other is uniformly random from [k] \ σ j (1), . . . , σ j (l − 1) . Therefore, the probability that (u 1 j , u 2 σ j (l) ) is monochromatic is 1 k−l+1 . Since recoloring a node implies recoloring all its 2 m−1 partners, we have that the total expected cost due to the edges incident on u 1 j in phase m is at least Summing over all nodes, we get that the total expected cost of stitching a pair of chains in phase m is at least where H x here means H x . Since there are (n/k)2 −m pairs of chains to connect in phase m, the result follows.

Lower Bounds for the Capacitated Case
In the capacitated disengagement variant of the problem, we model the case where machines have limited capacity. This constraint is formalized as follows. We assume that for each color i ∈ [k] we are given a color capacity W i ∈ N , and we require that in any coloring output by the recoloring algorithm, the total weight of nodes colored i is at most W i . We assume that the sum of all color capacities is at least the sum of all node weights. The case where the total capacity equals the total weight is called tight. 2 Note that if the instance is tight, then a node cannot be recolored alone: recoloring must be done by swapping colors with other nodes. We prove the following results.

Theorem 5.5
The competitive ratio of deterministic algorithms for tight capacitated recoloring is (n), even if nodes are unweighted.
Theorem 5. 6 The competitive ratio of randomzed algorithms for tight capacitated recoloring is (log n), even if nodes are unweighted.
We use the same framework for both the deterministic and the randomized cases. There are n = kW nodes of weight 1 each, and the capacity of each of the k colors is W .
The adversary constructs the following input sequence, which selects a set of W −1 nodes (denoted A ) with the same initial color, and creates edges between them and all of the other nodes, except one: The difference between the deterministic and the randomized cases is the way the selection of step 51 is implemented. We now proceed to present of the remainder of the proofs.
Proof of Theorem 5.5 For deterministic algorithms, the node v ∈ V selected in step (51) is such that its color is the color of some node in A . This is always possible since there are exactly W nodes in each color, and the set A is of size (W − 1) (the first node that fulfills it is a 0 ). Hence, any online deterministic algorithm pays a cost of at least 2 in each iteration of the loop of step (5), for a total cost of at least 2(n − W ) for all iterations.
After step (5) is repeated (n − W ) times, only one node v / ∈ A may have the same color as any node in A . Therefore, any valid coloring must have all nodes in A as well as v in the same color. The optimal algorithm swaps the colors of node a 0 and node v , paying a cost of 2 for the entire sequence. The competitive ratio of any online deterministic algorithm for the capacitated case is (n).

Proof of Theorem 5.6
Again we use Yao's principle. We specify an input distribution and prove a lower bound for the expected cost of any deterministic algorithm. The distribution is defined by implementing step (51) using a random selection: v is selected uniformly at random from V .
As before, there must be at least one node in V (but not in A ) that is colored the same as some node in A , and therefore the expected cost of any deterministic algorithm in step (5) is at least 2 · 1 |V | . The size of V starts at (n − W ), and decreases by 1 each loop until it reaches 1. Therefore we can bound from below the total expected cost for any deterministic algorithm: Note that H n−W = H n−n/k ≥ H n/2 for k > 1. As the optimal algorithm pays a cost of 2, we get that the competitive ratio of any randomized algorithm in the capacitated case is (log(n)).

Models of Fully-Dynamic Disengagement
In previous sections , we considered the partially-dynamic variant of the disengagement problem, in which every new edge is an additional, permanent constraint. In this section, we consider the fully-dynamic variant of the online disengagement problem (abbreviated FD below), where at every iteration i, the edge constraints may also be deleted (in FD, input sequences may be of unbounded length). It turns out that FD is more difficult than partially-dynamic disengagement. In this section we first discuss various plausible models of FD and show their equivalence, and then show that even a very simple dynamic instance forces an (n) lower bound on the competitiveness of deterministic algorithms. The latter result is obtained by reduction from Metrical Task Systems.
There are several (yet equivalent) ways to define the fully-dynamic Disengagement problem: The single edge model (SE): At iteration i upon the arrival of edge e i = (u, v), the algorithm must make sure that c i (u) = c i (v), i.e, only the coloring of the last edge must be maintained. Expiration time model (ET): Every edge arrives with a prescribed expiration timeafter which it is deleted. Edge insertions and deletions model (InD): In this model, at every iteration either an existing edge in the graph is deleted, or an non-existing one appears. The algorithm is required at every iteration to maintain a proper coloring of the graph.
We first argue that the models are essentially equivalent.
Theorem 6.1 A lower bound on the competitive ratio of (randomized) algorithms under one of the three models of dynamic disengagement, holds under the other two models as well.
Theorem 6.1 is proven using the following three lemmas.

Lemma 6.2
If ρ 1 is a lower bound on the deterministic (or randomized) competitive ratio for the "SE" model, then ρ 1 is a lower bound on the deterministic (respectively, randomized) competitive ratio for the "ET" model.

Proof
It can be easily shown that any input sequence of the "SE" model is also an input sequence of the "ET" model, with the expiration time of every edge set to 1.
Since the lower bound for the special case also holds for the general case, the claim holds.

Lemma 6.3
If ρ 2 is a lower bound on the deterministic (or randomized) competitive ratio for the "ET" model, then ρ 2 is a lower bound on the deterministic (respectively, randomized) competitive ratio for the "InD" model.
Proof It can also be demonstrated that any input sequence of the "ET" model can be represented using the "InD" model. Each time an edge is presented (or expires) in the former model, it is inserted (or deleted) in the latter model.

Lemma 6.4
If ρ 3 is a lower bound on the deterministic (or randomized) competitive ratio for the "InD" model, then ρ 3 is a lower bound of the deterministic (respectively, randomized) competitive ratio for the "SE" model.
To prove Lemma 6.4, we first prove the following lemma: To prove the claim, suppose, for contradiction, that for some ε > 0, the probability of A outputting a proper coloring of G i after any number of phases is never more 1 − ε. Then, with probability of at least ε, A pays at least 1 in each phase (when a monochromatic edge is inserted). The total expected cost of A is therefore unbounded.
On the other hand, the optimal cost is at most |V |, contradicting the assumption that A has bounded competitive ratio.
Proof of Lemma 6.4 Assume, for contradiction, that there exists an algorithm A d for the "SE" model with a competitive ratio strictly smaller than ρ 3 . We construct an algorithm A s for the "InD" model as follows. Given input I = {G 1 , G 2 , . . .} (in the "InD" model), A s runs A d on input I D (in the "SE" model) as defined in Lemma 6.5.
According to Lemma 6.5, since A d has a bounded competitive ratio, then A d outputs a solution to E i w.p. 1. Hence, A s is well defined.
To analyze the cost, consider iteration i of A s . Let c m i denote the output of A d after E i was input to it for m-th time, and let c i denote the output of A s in the i-th step.
Let opt s denote an optimal solution to I and let opt d denote an optimal solution to I d . Then we have by assumption on competitiveness ofA d ≤ ρ 3 · cost(opt s (I )) because opt s (I ) is also a solution to I d , contradicting the assumption that ρ 3 is a lower bound on the competitiveness of deterministic algorithms for the "InD" model.
We note that FD is at least as hard as the partially-dynamic model.

Corollary 6.6
If ρ is a lower bound on the deterministic (or randomized) competitive ratio for partially-dynamic disengagement, then ρ is a lower bound of the deterministic (respectively, randomized) competitive ratio for fully-dynamic disengagement.
Proof The partially dynamic (PD) disengagement model can be directly represented by the FD "ET" model, with the expiration time of every edge set to ∞. Hence, the lower bound for the PD case also holds for the "ET" model, and according to Theorem 6.1, such bound holds for any of the other FD models.

Full-Dynamic Disengagement and Metrical Task Systems
We now give evidence to the hardness of FD disengagement using a reduction from metrical task systems (MTS). Let us first define the terms.
In the MTS problem [7], a metric space M of n points is given. A server is always located at some point in the metric space. Requests arrive in an online fashion, where the i'th request is a cost function f i : M → R + . The algorithm responds to a request f i by moving the server from its current location u ∈ M to a new location v ∈ M, paying the distance between the locations in the metric space (or not moving the server, and paying nothing). Then, the algorithm must pay the cost of the current location of the server, which is f i (v). We show that FD is as hard as a particular type of an MTS. Theorem 6.7 If there exists an O( f (n))-competitive algorithm for FD disengagement for every graph of n nodes with 2 colors, then there exists an O( f (n))-competitive algorithm for metrical task system on an odd cycle on length n.
In [7], a lower bound of (n)-competitive was presented for every deterministic algorithm for MTS on every set of n points. Hence we have the following.

Corollary 6.8 Any deterministic algorithm for FD disengagement with n nodes is (n)-competitive.
A lower bound of (log n/log log n)-competitiveness for every randomized algorithm for MTS on every set of n points was given in [6]. This implies the following corollary. Corollary 6.9 Any randomized algorithm for FD disengagement with n nodes is log n log log n -competitive.
Proof of Theorem 6. 7 We assume without loss of generality that the functions in the MTS input are in fact Kronecker delta functions: they are supported on only one point, and the cost of that point is 1. We also assume w.l.o.g. that the FD disengagement algorithm is lazy, i.e., it only recolors endpoints of the current request.
We now describe the reduction. Suppose we are given an instance M of MTS with an odd-cycle metric space C 1 of n points. We construct an instance D of FD with n points arranged in a cycle, such that the nodes of C 1 correspond to the n edges of C 2 in the natural way. The intended interpretation of nodes in C 1 is colorings in D, where a node x of C 1 means in C 2 that only the edge corresponding to x is monochromatic (and all other edges in C 2 are bichromatic). The initial coloring in D is such that the only monochromatic edge in D is the edge corresponding to the initial position of the server in M. Thereafter, whenever a point x ∈ C 1 is requested in M, the corresponding edge in C 2 is requested in D. To see that the intended interpretation is maintained, consider any algorithm ALG D for FD. Easy induction shows that after every step, there is exactly one monochromatic edge in the odd cycle C 2 : The base case holds by the initial coloring; for the induction step, note that if a non-monochromatic edge is requested, no recoloring takes place. Otherwise, the currently monochromatic edge e is requested, and ALG D must recolor exactly one endpoint of e. If the clockwise (say) endpoint of e is recolored, then e is no longer monochromatic, and the next edge clockwise from e becomes monochromatic (and similarly for counter-clockwise), and the induction is proved.
Given the reduction, algorithm ALG M for the MTS problem is obtained from a given algorithm ALG D for FD by taking the MTS instance M, reducing it online to the FD instance D as desribed above, running ALG D on D, and interpreting the responses of ALG D back in M. That is, whenever ALG D moves the monochromatic edge clockwise, ALG M moves the server clockwise, and the same for counter-clockwise. Clearly, we have that ALG D has the same cost on D as ALG M has on M.
Finally, denoting by OPT M and OPT D the optimal solutions to M and D respectively, note that OPT D ≤ 2 OPT M : OPT D can move the monochromatic edge whenever OPT D moves the server, and can move the monochromatic edge clockwise and then immediately counter-clockwise to simulate paying a penalty (at a cost of 2). This completes the proof of the theorem.

Conclusion
In this paper we have introduced the problem of online disengagement and determined its competitive ratio in the case that conflicts are permanent and either that the final graph is bipartite or that the number of colors is larger than the maximum degree.
Many problems remain open.
A major problem we leave open is the competitive ratio in the fully-dynamic case, where conflicts are temporary.
Other natural variants that we leave for future research are the following.
• Explore further the capacitated disengagement case (Sect. 5.2). Using the coloring formalism, in this case we assume that each color l comes with prescribed maximum capacity W l such that in any coloring output by the algorithm, the total number (or, more generally, weight) of nodes assigned to color l does not exceed W l . • The list recoloring variant represents the case where jobs have both affinities and anti-affinities, i.e., each job is given both a subset of machines on which it may run, and disengagement requests express job separation constraints. Formally, this is modeled by requiring the colorings output by the algorithm to be list colorings. The lists may be fixed or change online. • In multiple disengagement, disengagement requests are arbitrary sets of jobs. If the requirement is that at least one of the jobs in a conflict set is not collocated with all others, we have a hypergraph recoloring problem. • Both Kashyop et al. [14] and Solomon and Wein [17] provide dynamic-coloring algorithms in the case of bounded (or constant) arboricity. Their methods might prove useful for the competitive recoloring case as well.
Note that all versions listed above make sense in either the static or the dynamic variants of the disengagement problem.