Dynamic Balanced Graph Partitioning
This paper initiates the study of the classic balanced graph partitioning problem from an online perspective: Given an arbitrary sequence of pairwise communication requests between nodes, with patterns that may change over time, the objective is to service these requests efficiently by partitioning the nodes into clusters, each of size , such that frequently communicating nodes are located in the same cluster. The partitioning can be updated dynamically by migrating nodes between clusters. The goal is to devise online algorithms which jointly minimize the amount of inter-cluster communication and migration cost.
The problem features interesting connections to other well-known online problems. For example, scenarios with generalize online paging, and scenarios with constitute a novel online variant of maximum matching. We present several lower bounds and algorithms for settings both with and without cluster-size augmentation. In particular, we prove that any deterministic online algorithm has a competitive ratio of at least , even with significant augmentation. Our main algorithmic contributions are an -competitive deterministic algorithm for the general setting with constant augmentation, and a constant competitive algorithm for the maximum matching variant.
Keywords: clustering, graph partitioning, competitive analysis, cloud computing
Graph partitioning problems, like minimum graph bisection or minimum balanced cuts, are among the most fundamental problems in theoretical computer science. They are intensively studied also due to their numerous practical applications, e.g., in communication networks, parallel processing, data mining and community discovery in social networks. Interestingly however, not much is known today about how to dynamically partition nodes which interact or communicate in a time-varying fashion.
This paper initiates the study of a natural model for online graph partitioning. We are given a set of nodes with time-varying pairwise communication patterns, which have to be partitioned into clusters of equal size . Intuitively, we would like to minimize inter-cluster interactions by mapping frequently communicating nodes to the same cluster. Since communication patterns change over time, partitions should be readjusted dynamically, that is, the nodes should be repartitioned, in an online manner, by migrating them between clusters. The objective is to jointly minimize inter-cluster communication and repartitioning costs, defined respectively as the number of communication requests “served remotely” and the number of times nodes are migrated from one cluster to another.
This fundamental online optimization problem has many applications. For example, in the context of cloud computing, may represent virtual machines or containers that are distributed across physical servers, each having cores: each server can host virtual machines. We would like to (dynamically) distribute the virtual machines across the servers such that datacenter traffic and migration costs are minimized.
1.1 The Model
Formally, the online Balanced RePartitioning problem (BRP) is defined as follows. There is a set of nodes, initially distributed arbitrarily across clusters, each of size . We call two nodes collocated if they are in the same cluster.
An input to the problem is a sequence of communication requests , where pair means that nodes exchange a fixed amount of data. For succinctness of later descriptions, we assume that a request occurs at time . At any time , an online algorithm needs to serve the communication request . Right before serving the request, the online algorithm can repartition the nodes into new clusters. We assume that a communication request between two collocated nodes costs 0. The cost of a communication request between two nodes located in different clusters is normalized to 1, and the cost of migrating a node from one cluster to another is , where is a parameter (an integer). For any algorithm Alg, we denote its total cost (consisting of communication plus migration costs) on sequence by .
The description of some algorithms (in particular the ones in section 3 and section 4) is more natural if they first serve a request and then optionally migrate. Clearly, this modification can be implemented at no extra cost by postponing the migration to the next step.
We are in the realm of competitive worst-case analysis and compare the performance of an online algorithm to the performance of an optimal offline algorithm. Formally, let resp. be the cost induced by on an online algorithm Onl resp. on an optimal offline algorithm Opt. In contrast to Onl, which learns the requests one-by-one as it serves them, Opt has a complete knowledge of the entire request sequence ahead of time. The goal is to design online repartitioning algorithms that provide worst-case guarantees. In particular, Onl is said to be -competitive if there is a constant such that for any input sequence it holds that
Note that cannot depend on input but can depend on other parameters of the problem, such as the number of nodes or the number of clusters. The minimum for which Onl is -competitive is called the competitive ratio of Onl.
We consider two different settings:
- Without augmentation:
The nodes fit perfectly into the clusters, i.e., . Note that in this setting, due to cluster capacity constraints, a node can never be migrated alone, but it must be swapped with another node at a cost of . We also assume that when an algorithm wants to migrate more than two nodes, this has to be done using several swaps, each involving two nodes.
- With augmentation:
An online algorithm has access to additional space in each cluster. We say that an algorithm is -augmented if the size of each cluster is , whereas the total number of nodes remains . As usual in competitive analysis, the augmented online algorithm is compared to the optimal offline algorithm with cluster capacity .
An online repartitioning algorithm has to cope with the following issues:
- Serve remotely or migrate (“rent or buy”)?
For a brief communication pattern, it may not be worthwhile to collocate the nodes: the migration might be too large in comparison to communication costs.
- Where to migrate, and what?
If an algorithm decides to collocate nodes and , the question becomes how. Should be migrated to the cluster holding , to the one holding , or should both nodes be migrated to a new cluster?
- Which nodes to evict?
There may not exist sufficient space in the desired destination cluster. In this case, the algorithm needs to decide which nodes to “evict” (migrate to other clusters), to free up space.
1.2 Our Contributions
This paper introduces the online Balanced RePartitioning problem (BRP), a fundamental dynamic variant of the classic graph clustering problem. We show that BRP features some interesting connections to other well-known online graph problems. For , BRP is able to simulate online paging problem and for for , BRP is a novel online version of maximum matching. We consider deterministic algorithms and make the following technical contributions:
- Algorithms for General Variant:
For the non-augmented variant, in section 3, we first present a simple -competitive algorithm. Our main technical contribution is an -competitive deterministic algorithm Crep for a setting with -augmentation (section 4). We emphasize that this bound does not depend on . This is interesting, as in many application domains of this problem, is small: for example, in our motivating virtual machine collocation problem, a server typically hosts only a small number of virtual machines (e.g., related to the constant number of cores on the server).
- Algorithms for Online Rematching:
For the special case of online rematching (, but arbitrary ), in section 5, we prove that a variant of a greedy algorithm is 7-competitive. We also demonstrate a lower bound of 3 for any deterministic algorithm.
- Lower Bounds:
By a reduction to online paging, in section 6.1, we show that for two clusters no deterministic algorithm can obtain a better bound than . While this shows an interesting link between BRP and paging, in section 6.2, we present a stronger bound. Namely, we show that for clusters, no deterministic algorithm can beat the bound of even with an arbitrary amount of augmentation, as long as the algorithm cannot keep all nodes in a single cluster. In contrast, online paging is known to become constant-competitive with constant augmentation .
1.3 A Practical Motivation
There are many applications to the dynamic graph clustering problem. To give just one example, we consider server virtualization in datacenters. Distributed cloud applications, including batch processing applications such as MapReduce, streaming applications such as Apache Flink or Apache Spark, and scale-out databases and key-value stores such as Cassandra, generate a significant amount of network traffic and a considerable fraction of their runtime is due to network activity . For example, traces of jobs from a Facebook cluster reveal that network transfers on average account for 33% of the execution time . In such applications, it is desirable that frequently communicating virtual machines are collocated, i.e., mapped to the same physical server, since communication across the network (i.e., inter-server communication) induces network load and latency. However, migrating virtual machines between servers also comes at a price: the state transfer is bandwidth intensive, and may even lead to short service interruptions. Therefore the goal is to design online algorithms that find a good trade-off between the inter-server communication cost and the migration cost.
2 Related Work
The static offline version of our problem, i.e., a problem variant where migration is not allowed, where all requests are known in advance, and where the goal is to find best node assignment to clusters, is known as the -balanced graph partitioning problem. The problem is NP-complete, and cannot even be approximated within any finite factor unless P = NP . The static variant where corresponds to a maximum matching problem, which is polynomial-time solvable. The static variant where corresponds to the minimum bisection problem, which is already NP-hard . Its approximation was studied in a long line of work [31, 3, 17, 16, 24, 30] and the currently best approximation ratio of was given by Räcke . The -approximation given by Krauthgamer and Feige  can be extended to general , but the running time becomes exponential in .
The inaproximability of the static variant for general values of motivated research on the bicriteria variant, which can be seen as the offline counterpart of our cluster-size augmentation approach. Here, the goal is to develop -balanced graph partitioning, where the graph has to be partitioned into components of size less than and the cost of the cut is compared to the optimal (non-augmented) solution where all components are of size . The variant where was considered in [26, 32, 15, 14, 25]. So far the best result is an -approximation by Krauthgamer et al. , which builds on ideas from the -approximation algorithm for balanced cuts by Arora et al. . For smaller values of , i.e., when with a fixed , Andreev and Räcke gave an approximation , which was later improved to by Feldmann and Foschini .
The BRP problem considered in this paper was not previously studied. However, it bears some resemblance to the classic online problems; below we highlight some of them.
Our model is related to online paging [33, 20, 28, 1], sometimes also referred to as online caching, where requests for data items (nodes) arrive over time and need to be served from a cache of finite capacity, and where the number of cache misses must be minimized. Classic problem variants usually boil down to finding a smart eviction strategy, such as Least Recently Used (LRU). In our setting, requests can be served remotely (i.e., without fetching the corresponding nodes to a single cluster). In this light, our model is more reminiscent of caching models with bypassing [12, 13, 22]. Nonetheless, we show that BRP is capable of emulating online paging.
The BRP problem is an example of a non-uniform problem : the cost of changing the state is higher than the cost of serving a single request. This requires finding a good trade-off between serving requests remotely (at a low but repeated communication cost) or migrating nodes into a single cluster (entailing a potentially high one-time cost). Many online problems exhibit this so called rent-or-buy property, e.g., ski rental problem [23, 27], relaxed metrical task systems , file migration [8, 10], distributed data management [9, 6, 7], or rent-or-buy network design [5, 34, 19].
There are two major differences between BRP and the problems listed above. First, these problems typically maintain some configuration of servers or bought infrastructure and upon a new request (whose cost typically depends on the distance to the infrastructure), decide about its reconfiguration (e.g., server movement or purchasing additional links). In contrast, in our model, both end-points of a communication request are subject to optimization. Second, in the BRP problem a request reveals only very limited information about the optimal configuration to serve it: There exist relatively long sequences of requests that can be served with zero cost from a fixed configuration. Not only can the set of such configurations be very large, but such configurations may also differ significantly from each other.
3 A Simple Upper Bound
As a warm-up and to present the model, we start with a straightforward -competitive deterministic algorithm Det. At any time, Det serves a request, adjusts its internal structures (defined below) accordingly and then possibly migrates nodes. Det operates in phases, and each phase is analyzed separately. The first phase starts with the first request.
In a single phase, Det maintains a helper structure: a complete graph on all nodes, with an edge present between each pair of nodes. We say that a communication request is paid (by Det) if it occurs between nodes from different clusters, and thus entails a cost for Det. For each edge between nodes and , we define its weight to be the number of paid communication requests between and since the beginning of the current phase.
Whenever an edge weight reaches , it is called saturated. If a request causes the corresponding edge to become saturated, Det computes a new placement of nodes (potentially for all of them), so that all saturated edges are inside clusters (there is only one new saturated edge). If this is not possible, node positions are not changed, the current phase ends with the current request and a new phase begins with the next request. Note that all edge weights are reset to zero at the beginning of a phase.
Det is -competitive.
We bound the costs of Det and Opt in a single phase. First, observe that whenever an edge weight reaches , its endpoint nodes will be collocated until the end of the phase, and therefore its weight is not incremented anymore. Hence the weight of any edge is at most .
Second, observe that the graph induced by saturated edges always constitutes a forest. For the sake of contradiction, suppose that, at a time , two nodes and , which are not connected by a saturated edge, become connected by a path of saturated edges. From that time onward, Det stores them in a single cluster. Hence, the weight cannot increase at subsequent time points, and may not become saturated. The forest property implies that the number of saturated edges is smaller than .
The two observations above allow us to bound the cost of Det in a single phase. The number of reorganizations is at most the number of saturated edges, i.e., at most . As the cost associated with a single reorganization is , the total cost of all node migrations in a single phase is at most . The communication cost itself is equal to the total weight of all edges, and by the first observation, it is at most . Hence for any phase (also for the last one), it holds that .
Now we lower-bound the cost of Opt on any phase but the last one. If Opt performs a node swap in , it pays . Otherwise its assignment of nodes to clusters is fixed throughout . Recall that at the end of , Det failed to reorganize the nodes. This means that for any static mapping of the nodes to clusters (in particular the one chosen by Opt), there will be a saturated intra-cluster edge. The communication cost over such an edge incurred by Opt is at least (it can be also strictly greater than as the edge weight only counts the communication requests paid by Det).
Therefore, the Det-to-Opt cost ratio in any phase but the last one is at most and the cost of Det on the last phase is at most . Hence, for any input .
4 Algorithm Crep
In this section, we present the main result of this paper, a Component-based REPartitioning algorithm (Crep) which achieves a competitive ratio of with augmentation , for any (i.e., the augmented cluster is of size at least ). Crep maintains a similar graph structure as the simple deterministic -competitive algorithm from the previous section, i.e., it keeps counters denoting how many times it paid for a communication between two nodes. Similarly, at any time , Crep serves the current request, adjusts its internal structures, and then possibly migrates nodes. Unlike Det, however, the execution of Crep is not partitioned into global phases: the reset of counters to zero can occur at different times.
4.1 Algorithm Definition
We describe the construction of Crep in two stages. The first stage uses an intermediate concept of communication components, which are groups of at most nodes. In the second stage, we show how components are assigned to clusters, so that all nodes from any single component are always stored in a single cluster.
Stage 1: Maintaining Components
Roughly speaking, nodes are grouped into components if they communicated a lot recently. At the very beginning, each node is in a singleton component. Once the cumulative communication cost between nodes distributed across components exceeds , Crep merges them into a single component. If a resulting component size exceeds , it becomes deleted and replaced by singleton components.
More precisely, the algorithm maintains a time-varying partition of all nodes into components. As a helper structure, Crep keeps a complete graph on all nodes, with an edge present between each pair of nodes. For each edge between nodes and , Crep maintains its weight . We say that a communication request is paid (by Crep) if it occurs between nodes from different clusters, and thus entails a cost for Crep. If and belong to the same component, then . Otherwise, is equal to the number of paid communication requests between and since the last time when they were placed in different components by Crep. It is worth emphasizing that during an execution of Crep, it is possible that even when and belong to the same cluster.
For any subset of components (called component-set), by we denote the total weight of all edges between nodes of . Note that positive weight edges occur only between different components of . We call a component-set trivial if it contains only one component; in such a case.
Initially, all components are singleton components and all edge weights are zero. At time , upon a communication request between a pair of nodes and , if and lie in the same cluster, the corresponding cost is and Crep does nothing. Otherwise, the cost entailed to Crep is , nodes and lie in different clusters (and hence also in different components), and the following updates of weights and components are performed.
Weight increment. Weight is incremented.
Merge actions. We say that a non-trivial component-set is mergeable if . If a mergeable component-set exists, then all its components are merged into a single one. If multiple mergeable component-sets exist, Crep picks the one with maximum number of components, breaking ties arbitrarily. Weights of all intra- edges are reset to zero, and thus intra-component edge weights are always zero. A mergeable set induces a sequence of merge actions: Crep iteratively replaces two arbitrary components from by a component being their union (this constitutes a single merge action).
Delete action. If the component resulting from merge action(s) has more than nodes, it is deleted and replaced by singleton components. Note that weights of edges between these singleton components are all zero as they have been reset by the preceding merge actions.
We say that merge actions are real if they are not followed by a delete action (at the same time point) and artificial otherwise.
Stage 2: Assigning Components to Clusters
At time , Crep processes a communication request and recomputes components as described in the first stage. Recall that we require that nodes of a single component are always stored in a single cluster. To maintain this property for artificial merge actions, no actual migration is necessary. The property may however be violated by real merge actions. Hence, in the following, we assume that in the first stage Crep found a mergeable component set that triggers merge actions not followed by a delete action.
Crep consecutively processes each real merge action by migrating some nodes. We describe this process for a single real merge action involving two components and . As a delete action was not executed, , where denotes the number of component nodes. Without loss of generality, .
We may assume that and are in different clusters as otherwise Crep does nothing. If the cluster containing has free space, then is migrated to this cluster. Otherwise, Crep finds a cluster that has at most nodes, and moves both and there. We call the corresponding actions component migrations. By an averaging argument, there always exists a cluster that has at most nodes, and hence, with -augmentation, component migrations are always feasible.
4.2 Analysis: Structural Properties
We start with a structural property of components and edge weights. It states that immediately after Crep merges (and possibly deletes) a component-set, no other component-set is mergeable. This property holds independently of the actual placement of components in particular clusters.
At any time , after Crep performs its merge and delete actions (if any), for any non-trivial component-set .
We prove the lemma by an induction on steps. Clearly, the lemma holds before an input sequence starts as then for any non-trivial set . We assume that it holds at time and show it for time .
At time , only a single weight, say , may be incremented. If after the increment, Crep does not merge any component, then clearly for any non-trivial set . Otherwise, at time , Crep merges a component-set into a new component , and then possibly deletes and creates singleton components from its nodes. We show that the lemma statement holds then for any non-trivial component-set . We consider three cases.
Component-sets and do not share any common node. Then, and consist only of components that were present already right before time and they are all disjoint. The edge involved in communication at time is contained in , and hence does not contribute to the weight of . By the inductive assumption, held right before time . As is not affected by Crep actions at step , the inequality holds also right after time .
Crep does not delete and . Let . Let denote the total weight of all edges with one endpoint in and another in . As Crep merged component-set and did not merge component-set , was mergeable (), while was not, i.e., . Therefore, right after weight is incremented at time . Observe that when component-set is merged and all intra- edges have their weights reset to zero, neither nor is affected. Therefore after Crep merges into , .
Crep deletes creating singleton components and some of these components belong to set . This time, we define to be the set without these components ( might be also an empty set). In the same way as in the previous case, we may show that after Crep performs merge and delete operations. Hence, at this time . The last inequality follows as has strictly more components than .
Since only one request is given at a time, and since all weights and are integers, lemma immediately implies the following result.
Fix any time and consider weights right after they are updated by Crep, but before Crep performs merge actions. Then, for any component-set . In particular, for a mergeable component-set .
4.3 Analysis: Lower Bound on OPT
For estimating the cost of Opt, we pick any input sequence and we execute Crep on it. Then, we execute Opt on and we analyze its cost in terms of the number of merges and deletions performed by Crep. We split any swap of two nodes performed by Opt into two migrations of the corresponding nodes.
For any component maintained by Crep, let be the time of its creation. A non-singleton component is created at by the merge of a component-set, henceforth denoted by . For a singleton component, is the time when the component that previously contained the sole node of was deleted; if existed at the beginning of input . We will use time as an artificial time point that occurred before an actual input sequence.
For a non-singleton component , we define as the set of the following (node, time) pairs:
Intuitively, tracks the history of all nodes of from the time (exclusively) they started belonging to some previous component , until the time (inclusively) they become members of . Note that for any two components , sets and are disjoint. The union of all (over all components ) cover all possible node-time pairs (except for time zero).
For a given component , we say that a communication request between nodes and at time is contained in if both and . Note that only the requests contained in could contribute towards later creation of by Crep. In fact, by corollary , the number of these requests that entailed an actual cost to Crep is exactly .
We say that a migration of node performed by Opt at time is contained in if . For any component , we define as the cost incurred by Opt due to requests contained in , plus the cost of Opt migrations contained in . The total cost of Opt can then be lower-bounded by the sum of over all components . (The cost of Opt can be larger as does not account for communication requests not contained in for any component .)
Fix any component and partition into a set of disjoint component-sets . The number of communication requests in that are between sets is at least .
Let be the weight measured right after its increment at time . Observe that the number of all communication requests from that were between sets and that were paid by Crep is . It suffices to show that this amount is at least . By corollary , and . Therefore, .
For any component maintained by Crep, let denote set of clusters containing nodes of in the solution of Opt after Opt performs its migrations (if any) at time . In particular, if , then consists of only one cluster that contained the sole node of at the beginning of an input sequence.
For any non-trivial component , it holds that .
Fix a component and any node . Let be the number of Opt migrations of node at times . Furthermore, let be the set of clusters that contained at some moment of a time (in the solution of Opt). We extend these notions to components: and . Observe that .
We aggregate components of into component-sets called bundles, so that any two bundles have their nodes always in disjoint clusters. To this end, we construct a hypergraph, whose nodes correspond to clusters from . Each component defines a hyperedge that connects all nodes (clusters) that are in . Now we look at connected components of this hypergraph (called hypergraph parts to avoid ambiguity). As the hyperedge related to component connects nodes, there are
hypergraph parts. Each hypergraph part corresponds to a bundle consisting of components contained in clusters belonging to this part, i.e., the number of bundles is also .
By lemma , the number of communication requests in that are between different bundles is at least . Each such request is paid by Opt because, by the definition of bundles, it involves a communication between two nodes which Opt stored in different clusters. Additionally, involves node migrations in , and therefore .
For any input , let be the set of components that were eventually deleted by Crep. Then .
Fix any component . Consider a tree which describes how component was created: the leaves of are singleton components containing nodes of , the root is itself, and each internal node corresponds to a component created at a single time by merging its children.
We now sum over all components from , including the root and the leaves . The lower bound given by lemma sums telescopically, i.e.,
where the equality follows as any is a singleton component, and therefore . As has nodes, it has to span at least clusters of Opt, and therefore , where the second inequality follows because and thus .
The proof is concluded by observing that, for any two deleted components and , the corresponding trees and do not share common components, and therefore .
4.4 Analysis: Upper Bound on CREP
To bound the cost of Crep, we fix any input and introduce the following notions. Let be the sequence of merge actions (real and artificial ones) performed by Crep. For any real merge action , by we denote the size of the smaller component that was merged. For an artificial merge action, we set .
Recall that denotes the set of all components that become eventually deleted by Crep. Let be the set of all components that exist when Crep finishes sequence . Note that is the total weight of all edges after processing .
We split into two parts: the cost of serving requests, , and the cost of node migrations, .
For any input , .
The proof follows by an induction on all requests of . Whenever Crep pays for the communication request, the corresponding edge weight is incremented and both sides increase by . At a time when components are merged, merge actions are executed and the sum of all edge weights decreases exactly by . Then, the value of both sides remain unchanged.
For any input , with -augmentation, .
If Crep has more than nodes in cluster (for ), then we call this excess overflow of ; otherwise, the overflow of is zero. We denote the overflow of cluster measured right after processing sequence by . It is sufficient to show the following relation for any sequence :
The proof will follow by an induction on all requests in . Clearly, (1) holds trivially at the beginning, as there are no overflows, and thus both sides of (1) are zero. Assume that (1) holds for a sequence and we show it for sequence , where is some request.
We may focus on request that triggers component(s) migration as otherwise (1) holds trivially. Such a migration is triggered by a real merge action of two components and . We assume that , and hence . Note that , as otherwise the resulting component would be deleted and no migration would be performed.
Let and denote the cluster that held components and , respectively, and be the destination cluster for and (it is possible that ). For any cluster , we denote the change in its overflow by . It suffices to show that the change of the left hand side of (1) is at most the increase of its right hand side, i.e.,
For the proof, we consider three cases.
had at least empty slots. In this case, Crep simply migrates to paying . Then, , , , and thus (2) follows.
had less than empty slots and . Crep migrates both and to component and the incurred cost is . It remains to show that the second summand of (2) is at most . Clearly, and . Furthermore, the number of nodes in was at most before the migration by the definition of Crep, and thus is at most after the migration. This implies that .
had less than empty slots and . As in the previous case, Crep migrates and to component , paying . This time, can be much larger than the right hand side of (2), and thus we will resort to showing that the second summand of (2) is at most .
As in the previous case, and . Observe that . As the migration of to was not possible, the initial number of nodes in was greater than , i.e., . As component was migrated out of , the number of overflow nodes in changes by
Therefore, the second summand of (2) is at most as desired.
4.5 Analysis: Competitive Ratio
In the previous two subsections, we related to the total size of components that are deleted by Crep (cf. lemma ) and to , where the latter amount is related to the merging actions performed by Crep (cf. lemma ). Now we will link these two amounts. Note that each delete action corresponds to preceding real merge actions that led to the creation of the eventually deleted component.
For any input , it holds that , where all logarithms are binary.
We prove the lemma by an induction on all requests of . At the very beginning, both sides of the lemma inequality are zero, and hence the induction basis holds trivially. We assume that the lemma inequality is preserved for a sequence and we show it for sequence , where is an arbitrary request. We may assume that triggers some merge actions, otherwise the claim follows trivially.
First, assume triggered a sequence of real merge actions. We show that the lemma inequality is preserved after processing each merge action. Let and be merged components, with sizes and , where without loss of generality. Due to such action, the right hand side of the lemma inequality increases by
As the left hand side of the inequality changes exactly by , the inductive hypothesis holds.
Second, assume triggered a sequence of artificial merge actions (i.e., followed by a delete action) and let denote components that were merged to create component that was immediately deleted. Then, the right hand side of the lemma inequality changes by . As the left hand side of the lemma inequality is unaffected by artificial merge actions, the inductive hypothesis follows also in this case.
With augmentation at least , Crep is -competitive.
Regarding a bound for , we observe the following. First, if Crep executes artificial merge actions, then they are immediately followed by a delete action of the resulting component . The number of artificial merge actions is clearly at most , and thus the total number of all artificial actions in is at most . Second, if Crep executes a real merge action , then . Combining these two bounds yields . We use this inequality and later apply lemma to bound obtaining
By lemma , . This yields
To bound , observe that the component-set contains at most components, and hence by lemma , . Furthermore, the maximum of is achieved when all nodes in a specific cluster constitute a single component. Thus, . In total, , i.e., it can be upper-bounded by a constant independent of input sequence , which concludes the proof.
5 Online Rematching
Let us now consider the special case where clusters are of size two (, arbitrary ). This can be viewed as an online maximal (re)matching problem: clusters of size two contain (“match”) exactly one pair of nodes, and maximizing pairwise communication within each cluster is equivalent to minimizing inter-cluster communication.
5.1 Greedy Algorithm
We define a natural greedy online algorithm Greedy, parameterized by a real positive number . Similarly to our other algorithms, Greedy maintains an edge weight for each pair of nodes. The weights of all edges are initially zero. Weights of intra-cluster edges are always zero and weights of inter-cluster edges are related to the number of paid communication requests between edge endpoints.
When facing an inter-cluster request between nodes and , Greedy increments the weight , where . Let and be the nodes collocated with and , respectively. If after the weight increase, it holds that , Greedy performs a swap: it places and in one cluster and and in another; afterwards it resets the weights of edges and to 0. Finally, Greedy pays for the request between and . Note that if the request triggered a migration, then Greedy does not pay its communication cost.
We use to denote the set of all edges. Let () denote the set of all edges , such that and are collocated by Greedy (Opt). Note that and are perfect matchings on the set of all nodes.
For the analysis, we associate the following edge-potential with any edge :
where is a constant that will be defined later.
The union of and constitutes a set of alternating cycles: an alternating cycle of length (for some ) consists of nodes, edges from and edges from , interleaved. The case is degenerate: such a cycle consists of a single edge from , but we still count it as a cycle of length . We define the cycle-potential as
where is the number of all cycles and is a constant that will be defined later.
To simplify the analysis, we slightly modify the way weights are increased by Greedy. The modification is applied only when the weight increment triggers a node migration. Recall that this happens when there is an inter-cluster request between nodes and . The corresponding weight is then increased by . After the increase, it holds that . (Nodes and are those collocated with and , respectively.) Instead, we increase possibly by a smaller amount, so that becomes equal to . This modification allows for a more streamlined analysis and is local: before and after the modification, Greedy performs a migration and right after that it resets weight to zero.
We split processing of a communication request into three stages. In the first stage, Opt performs an arbitrary number of migrations. In the second stage, weight is increased accordingly and both Opt and Greedy serve the request. It is possible that the weight increase triggers a node swap of Greedy, in which case its serving cost is zero. Finally, in the third stage, Greedy may perform a node swap.
We will show that for an appropriate choice of , and , for all three stages described above the following inequality holds:
Here, and denote the increases of Greedy’s and Opt’s cost, respectively. and are the changes of the potentials and . The 7-competitiveness then immediately follows from summing (3) and bounding the initial and final values of the potentials.
If , then (3) holds for the first stage.
We consider any node swap performed by Opt. Clearly, for such an event and . The number of cycles decreases at most by one, and thus .
We will now upper-bound the change in the edge-potentials. Let and be the edges that were removed from by the swap and let and be the edges added to . For any , as the initial value of is at least and the final value of is at most . Similarly, as the initial value of is at least and the final value of is at most