DeepAI

# Online Graph Matching Problems with a Worst-Case Reassignment Budget

In the online bipartite matching with reassignments problem, an algorithm is initially given only one side of the vertex set of a bipartite graph; the vertices on the other side are revealed to the algorithm one by one, along with its incident edges. The algorithm is required to maintain a matching in the current graph, where the algorithm revises the matching after each vertex arrival by reassigning vertices. Bernstein, Holm, and Rotenberg showed that an online algorithm can maintain a matching of maximum cardinality by performing amortized O(log^2 n) reassignments per arrival. In this paper, we propose to consider the general question of how requiring a non-amortized hard budget k on the number of reassignments affects the algorithms' performances, under various models from the literature. We show that a simple, widely-used algorithm is a best-possible deterministic algorithm for all these models. For the unweighted maximum-cardinality problem, the algorithm is a (1-2/k+2)-competitive algorithm, which is the best possible for a deterministic algorithm both under vertex arrivals and edge arrivals. Applied to the load balancing problem, this yields a bifactor online algorithm. For the weighted problem, which is traditionally studied assuming the triangle inequality, we show that the power of reassignment allows us to lift this assumption and the algorithm becomes a 1/2-competitive algorithm for k=4, improving upon the 1/3 of the previous algorithm without reassignments. We show that this also is a best-possible deterministic algorithm.

• 3 publications
• 2 publications
• 5 publications
• 5 publications
11/03/2020

### Secretary Matching with General Arrivals

We provide online algorithms for secretary matching in general weighted ...
01/08/2020

### Achieving Competitiveness in Online Problems

In the setting of online algorithms, the input is initially not present ...
02/23/2020

### Online Stochastic Max-Weight Matching: prophet inequality for vertex and edge arrival models

We provide prophet inequality algorithms for online weighted matching in...
05/17/2020

### Matching in Stochastically Evolving Graphs

This paper studies the maximum cardinality matching problem in stochasti...
03/04/2021

### An Optimal Truthful Mechanism for the Online Weighted Bipartite Matching Problem

In the weighted bipartite matching problem, the goal is to find a maximu...
02/12/2021

### A Subexponential Algorithm for ARRIVAL

The ARRIVAL problem is to decide the fate of a train moving along the ed...
02/20/2021

### Online Stochastic Max-Weight Bipartite Matching: Beyond Prophet Inequalities

The rich literature on online Bayesian selection problems has long focus...

## 1 Introduction

Suppose that we have a set of servers, and that clients to be assigned to these servers arrive one by one. Each time a client arrives, the subset of servers to which the client may be assigned is revealed. In this setting, the online bipartite matching problem asks us to irrevocably commit whether the client will be assigned or not and, if assigned, to which server. This commitment needs to be made immediately after each arrival, and the objective is to maximize the number of assigned clients so that every server is assigned at most one client. This problem was first considered by the seminal work of Karp, Vazirani, and Vazirani [32], which gives the best-possible randomized -competitive algorithm. Their analysis was later improved (with the same competitive ratio, of course) by Goel & Mehta [21], Birnbaum & Mathieu [8], and Devanur, Jain & Kleinberg [14].

In that problem, once the algorithm commits itself to match a vertex (i.e., a server or a client), it ensures that the vertex remains matched from now onward. However, the choice of a particular edge in the matching may not be as important in some applications. Thus, one of natural goals would be to design an online algorithm that still makes irrevocable commitments to vertices that they will be matched, but performs (a minimum number of) reassignments. Introduced by Grove, Kao, Krishnan, and Vitter [22], this question was considered also by Bernstein, Holm, and Rotenberg [6] who showed an online algorithm can indeed maintain a maximum-cardinality matching by performing amortized reassignments per arrival, i.e., reassignments in total.

However, what if we require a worst-case bound? In this paper, we propose to consider, under a variety of models from the literature, the general question of how the algorithms’ performances are affected when a hard (non-amortized) budget is imposed on the number of reassignments per arrival. We will demonstrate that a simple, widely-used algorithm is a best-possible deterministic algorithm under all these models. The algorithm, which was also used to give the amortized bound, is indeed simple to describe here:

Find a shortest (or most profitable, if the model is weighted) augmenting path with at most vertices, starting from the newly-arrived one; augment the matching along the path.

Let us formally describe the classic model of maximum-cardinality online bipartite matching under vertex arrivals, augmented with a hard budget on the number of reassignments. For a bipartite graph , the algorithm is initially given and the hard budget . In the next timesteps, the vertices in are revealed one by one along with its incident edges; the algorithm outputs at most (re)assignments that give a new matching at each timestep. If some vertices in become matched as a result, this means that the algorithm is now committed to keep them matched. The new matching, of course, must respect all the previous commitments the algorithm has made so far. When , i.e., an algorithm is allowed to perform only assignments but no reassignments (note that adding an edge to the matching already involves two assignment operations on its two endpoints), the given algorithm is -competitive [32]. In Section 3.1, we show the following generalization, a tradeoff between and the competitive ratio.

###### Theorem 1.

The given algorithm is a -competitive algorithm for the maximum-cardinality online bipartite matching problem under vertex arrivals with a hard budget of on the number of reassignments.

This is proven by first showing that the algorithm has an invariant that the current graph, with respect to the current matching, does not have an augmenting path of length at most . The proof of this invariant crucially relies on the fact that the algorithm chooses shortest augmenting paths—in fact, an arbitrary choice of augmenting paths may allow short augmenting paths to exist when : see Observation 17 in Appendix A. Once we have this invariant though, the desired conclusion follows from the fact that such a matching is a good approximation to the maximum one.

Theorem 1 is complemented with the following lower bound (see Section 3.2).

###### Theorem 2.

For all constant , no deterministic algorithm is -competitive for the maximum-cardinality online bipartite matching problem under vertex arrivals with a hard budget of on the number of reassignments.

When the graph is weighted, it is easy to see that no online algorithm can have a positive constant competitive ratio. As such, Kalyanasundaram and Pruths [31] study the model where the algorithm is required to maintain a left-perfect matching and the edge costs are assumed to form a metric, to give a -competitive algorithm when no reassignments are allowed (i.e., ). We remark that we can show both the metric assumption and the left-perfect requirement are necessary for this problem to admit a constant competitive ratio.222This is true even when we allow the “additive error” of the competitive ratio to depend on the maximum edge weight. When we only require left-perfect matching, consider the following oblivious adversary. The adversary constructs a complete bipartite graph with , where (and ) are to be chosen later. Let be the last vertices of , according to the arrival order. Let be a set of vertices, sampled uniformly at random. Every edge between and has weight , and all other edges have weight .
When we only assume metric weights, consider the following oblivious adversary. Let and , where and are to be chosen later. The edge weights of the complete bipartite graph is defined as , where also is to be chosen later. The adversary reveals the vertices in in a non-decreasing order of index .
For two constants and , in order to see that no randomized online algorithm can output a solution of expected value at least , we choose and for the first case; we choose and for the second case. Note that only depends on in the second case.
In Section 4.1, we consider the case where reassignments are allowed, and show that the power of reassignments enables us to remove the metric assumption and obtain a better competitive ratio.

###### Theorem 3.

The given algorithm is a -competitive algorithm for the maximum-weight online bipartite left-perfect matching problem with general weights under vertex arrivals with a hard budget on the number of reassignments.

This again is complemented with the following lower bound, which holds even for -weighted graphs (see Section 4.2).

###### Theorem 4.

For all constant , no deterministic algorithm is -competitive for the maximum-weight online bipartite left-perfect matching problem under vertex arrivals with , even when all edge weights are either or .

Returning to the unweighted realm, nonbipartite graphs have also been the target of interest [28, 29, 20]. Recently, Gamlath, Kapralov, Maggiori, Svensson, and Wajc [20] gave a -competitive algorithm for some constant . Our algorithm applies to this model as well, yielding a best-possible deterministic algorithm. We will not directly prove this, though, since it is implied by Theorem 1 and the proof of Theorem 2. Another widely studied setting that further generalizes the nonbipartite case is the edge-arrival model. This model is traditionally defined by considering edges as the “online object” to which irrevocable commitments need to be made, and therefore the problem definition becomes slightly less natural in conjunction with reassignments. We will however define an edge-arrival model partially because it still serves as a generalization of other models. In this model, it is edges that arrive at each timestep, but the algorithm still makes commitments to vertices that they will be matched. The given algorithm—if we find an augmenting path “containing the newly-arrived edge” rather than “starting from the newly-arrived one”—is a competitive algorithm (see Section 3.1):

###### Theorem 5.

The given algorithm is a -competitive algorithm for the maximum-cardinality online matching problem under edge arrivals with a hard budget of on the number of reassignments.

We omit the proof of the following lower bound as it is implied by Theorem 8.

###### Theorem 6.

For all constant , no deterministic algorithm is -competitive for the maximum-cardinality online matching problem under edge arrivals with a hard budget of on the number of reassignments.

#### Other Results and Future Directions.

We believe one natural question is how online problems in general admit better algorithms when we allow a nonzero budget on the number of modifications to the solution at each timestep. For a small example, our results bear implications on the load balancing problem, as was the case for other previous results on the online matching problem [24, 7, 6]. In this problem, servers can be assigned multiple clients, but the objective is to minimize the maximum number of clients assigned to a single server. Gupta, Kumar, and Stein [24] give a -competitive algorithm for this problem with amortized reassignments per arrival, and Bernstein et al. [6] give a -competitive algorithm with worst-case reassignments per arrival. Theorem 1 leads to the following bifactor online algorithm giving an explicit tradeoff between the hard budget and the ratio of served clients. Its proof follows from the standard guess-and-double framework (see, e.g., [24, 7]) and is omitted here.

###### Theorem 7.

For the load balancing problem with a hard budget on the number of reassignments, there exists a -competitive algorithm that assigns at least fraction of the clients.

Another important question is on the power of randomness in the problems considered in this paper. While we show that the given algorithm yields the best-possible competitive ratios of a deterministic algorithm for these problems, it remains open whether randomization helps. In this line, we conclude with the following theorem that shows randomization does not help under the edge-arrival model against adaptive online adversaries. (See Section 3.2.)

###### Theorem 8.

For all constant , no randomized algorithm is -competitive against an adaptive online adversary for the maximum-cardinality online matching problem under edge arrivals with a hard budget of on the number of reassignments.

#### Related Work.

Grove et al. [22] first introduced the notion of reassignments to the online bipartite matching problem and showed that, for a special case where every vertex in has degree at most two, an online algorithm can maintain a left-perfect matching by performing amortized reassignments per arrival. Chaudhuri, Daskalakis, Kleinberg, and Lin [13] considered various settings including the case where the graph is a forest in particular, for which they give an algorithm with amortized reassignments. Bosek, Leniowski, Sankowski, and Zych [9] considers the general version of the problem and obtain an algorithm with worst-case reassignments. Bosek, Leniowski, Sankowski, and Zych-Pawlewicz [10] show that taking shortest augmenting paths results in amortized reassignments for trees.

There was another proposal on relaxing irrevocability, which is to specify a limit on the number of times each edge can enter or leave the matching. This problem is sometimes called online matching with recourse. Avitabile, Mathieu, and Parkinson [3] considered a general class of online packing and covering problems and showed a -competitive algorithm for packing problems with the limit of . Epstein, Levin, Segev, and Weimann [15] considered the case where only edge departures are irrevocable and gave 0.186-competitive algorithms for the weighted case. Boyar, Favrholdt, Kotrbčík, and Larsen [11] gave a tight -competitive algorithm for the case where the decision on an edge can be revoked at most once. Although their model significantly differs from our proposed model, we note that their analysis, with hindsight, would have been useful in proving some special cases () of Theorems 1 and 5. Angelopoulos, Dürr, and Jin [2] considered the case where the decision can be revoked at most times and gave a -competitive algorithm.

The maximum-cardinality online bipartite matching problem has also been extensively studied for decades in a variety of settings and applications, including fully online models [41] and stochastic settings [18, 36, 25, 38]. This is the case for the weighted problem as well: subsequent to the introduction of the problem by Kalyanasundaram & Pruhs [31] and Khuller, Mitchell, & Vazirani [34], many results were obtained under the free disposal model, where a newly-arrived vertex can take away the match of another vertex [17, 35, 16, 27]. The weighted problem was also considered in vertex-weighted models [1, 30], stochastic settings [25, 12, 19], random arrivals [33], and the AdWords problem [37] for example. The minimization version also has been studied under various settings [34, 31, 39, 4, 40, 23].

## 2 Our Models and Algorithm

In this section, we present our models and the algorithm. While the models were already introduced in Section 1, we describe them here again for the sake of completeness. We begin with recalling a few standard definitions: given a graph and its matching , we say a vertex is matched if it is an endpoint of some edge in , and exposed otherwise. Given two sets and , denotes their symmetric difference: . For a path in , we will slightly abuse the notation and treat as a set of edges when it is clear from the context.

#### Models.

To define the maximum-cardinality online bipartite matching problem under vertex arrivals with a hard budget, consider a bipartite graph . The algorithm is initially given just and a hard budget . The rest of the graph is gradually revealed to the algorithm over timesteps: at each timestep, a vertex in “arrives”, at which point all its incident edges are revealed to the algorithm. The algorithm is required to output a bipartite matching in the current graph at the end of the timestep. The new matching must be obtained by performing at most (re)assignments starting from the previous one; if the algorithm matches a vertex at some point, it must remain matched.

A (re)assignment is defined as (re)assigning a vertex to another vertex: e.g., if the matching changes from to , this counts as four (re)assignments, each on , , , and . The “previous” matching of the first timestep is defined as the empty set.

In the maximum-cardinality online matching problem under edge arrivals with a hard budget, the graph is not necessarily bipartite. The algorithm is initially given and . The edges of the graph are revealed to the algorithm one by one, over timesteps. The rest of the model is the same as the bipartite vertex-arrival case: the algorithm outputs a matching that is obtained by performing at most (re)assignments. If the algorithm matches a vertex at some point, it must remain matched.

Finally, in the maximum-weight online bipartite left-perfect matching problem under vertex arrivals with a hard budget, we have a weighted complete bipartite graph . The algorithm is initially given and , and the vertices in arrives one by one along with all its incident edges and their weights. The algorithm then outputs a bipartite left-perfect matching in the current graph, which must be obtained by performing at most (re)assignments. Again, if the algorithm matches a vertex at some point, it must remain matched.

In all these problems, we can assume without loss of generality that the hard budget is even. The following observation justifies why.

###### Observation 9.

If an algorithm for the above problems outputs a matching at a timestep and at the next one, the minimum number of (re)assignments required to obtain from is even.

###### Proof.

Consider the graph . Let be the set of vertices with nonzero degrees in this graph. Note that we can obtain from by performing exactly one (re)assignment on each vertex in , and this is the minimum number of reassignments.

Graph is a union of vertex-disjoint alternating paths and alternating cycles. Every alternating cycle has an even number of vertices. Every alternating path must be an augmenting path because of the requirement that every matched vertex must remain so; thus, every path must also contain an even number of vertices. ∎

#### Algorithm.

When an object (vertex or edge) arrives, we find a shortest (if the model is unweighted) or most profitable (if weighted) one among all augmenting paths that contain the object.333It is easy to show that, in vertex-arrival models, the path will not just contain the new vertex but start from it. If such a path does not exist or is longer than , do nothing; otherwise, augment the matching along the path.

## 3 Unweighted Case

### 3.1 Analysis

In this section, we present the analysis of the given algorithm under the unweighted models.

The proof of the following lemma can be found in many places including [26]; we include a brief proof sketch for the sake of completeness.

###### Lemma 10 ([26]).

Let be a graph, be a matching in , and be a positive even number. If the length of every augmenting path of with respect to is at least ,

 |M|≥(1−2k+2)OPT,

where is the size of a maximum matching in .

###### Proof sketch.

Let be a maximum matching in . Suppose . Observe that is the union of vertex-disjoint alternating cycles and alternating paths; let be the set of these cycles and paths. We then have . Every alternating cycle has the same number of edges from and ; every augmenting path has at least edges and hence . ∎

The following lemma describes an operation we can perform on two augmenting paths, one of which is with respect to the matching that results from the augmentation using the other one. While it is tempting to imagine a simpler surgical operation satisfying the desired conditions, the correct version can be rather complicated when the graph is not bipartite. In favor of simplicity, we opted for the current version of the proof.

###### Lemma 11.

Let be a graph (which is not necessarily bipartite), and let be a matching in . Let be an augmenting path in with respect to , and let be an augmenting path in with respect to . Then, there exist two augmenting paths and in with respect to such that

1. and are edge-disjoint;

2. ; and

3. the set of the four endpoints of and equals the set of the four endpoints of and .

###### Proof.

Every vertex on is matched in ; hence, the two endpoints of are not on .

Consider the graph

. In this graph, exactly four vertices have odd degree: the endpoints of

and of . All other vertices have even degree. We claim that no vertex in has degree 3 or higher: suppose towards contradiction that a vertex has degree or higher. Since the endpoints of are not on , must be an internal vertex of . Since is on , there exists some edge incident with . Since is in the matching , must be in as well and therefore .

This shows that is a union of exactly two paths and some cycles, which are vertex-disjoint. Let and be these two paths, and we can see that the three conditions of this lemma are satisfied. Since the endpoints of are not on , they must be exposed in ; it only remains to show that and are alternating paths.

Note that, for every edge in , the edge is in if and only if it is in . Let be a vertex of degree in . If both of its incident edges are from , exactly one of them is in and there is nothing to prove. This is the case when both are from as well. Otherwise, must be on both and . Since the endpoints of are not on , must be an internal vertex of ; a similar argument to the above shows that there must exist some edge incident with that belongs to both and . Thus, one of the two edges incident with in is in , and the other is in . ∎

Now we present the competitive analysis for the bipartite vertex-arrival case.

###### Theorem 1 (restated).

The given algorithm is a -competitive algorithm for the maximum-cardinality online bipartite matching problem under vertex arrivals with a hard budget of on the number of reassignments.

###### Proof.

We will show that the length of every augmenting path is at least at the end of each timestep. The desired conclusion will follow from Lemma 10.

Use induction on time . We define the matching at the end of “time 0” as the empty set, and then the base case is trivial. Now consider a timestep . Let and , respectively, be the graph at time and . Let be the matching that is output by the algorithm at the end of time , and let be the vertex that newly arrives at time . From the induction hypothesis, every augmenting path in with respect to has length at least .

If the algorithm does nothing at time , this is because the length of every augmenting path in starting from with respect to is at least . Therefore, if there exists some other augmenting path in of length no more than , this path does not contain and is an augmenting path also in , contradicting the induction hypothesis.

Suppose that, at time , the algorithm augments along a shortest augmenting path in . Let be an arbitrary augmenting path in with respect to . Then, by Lemma 11, there exist two augmenting paths and in with respect to satisfying the conditions of the lemma. Without loss of generality, suppose that is an endpoint of . We then have since is an augmenting path in starting from with respect to . Since is an endpoint of , does not contain . Observe that is an augmenting path in with respect to from Conditions 1 and 3 of Lemma 11; from the induction hypothesis, we have . By Condition 2 of the lemma, we have , implying . ∎

###### Remark 12.

In the nonbipartite case, where the arrival of vertex reveals only the edges between and the other vertices that have already arrived, the given algorithm achieves the same competitive ratio, since neither Lemma 11 nor the proof of Theorem 1 assumes bipartiteness.

A similar argument gives a competitive analysis under edge arrivals. We defer its proof to Appendix A.

###### Theorem 5 (restated).

The given algorithm is a -competitive algorithm for the maximum-cardinality online matching problem under edge arrivals with a hard budget of on the number of reassignments.

### 3.2 Lower Bounds

In this section, we present the lower bounds under the unweighted models, starting with vertex-arrival models.

###### Theorem 2 (restated).

For all constant , no deterministic algorithm is -competitive for the maximum-cardinality online bipartite matching problem under vertex arrivals with a hard budget of on the number of reassignments.

###### Proof.

We will first present an adversary against which any deterministic algorithm outputs a matching of size strictly smaller than the optimum. We will then describe how we can modify this adversary to show the desired lower bound. Recall that oblivious adversaries are as powerful as adaptive offline adversaries against deterministic algorithms (see, e.g., [5]). As such, we assume an adaptive offline adversary in this proof.

Let . Let be a bipartite graph with , whose vertices are named as follows: and . The adversary gradually reveals this while maintaining the following invariant, possibly by renaming some vertices, right before the arrival of the -th vertex:

For all , has already arrived and is adjacent to exactly two vertices, and , and is in the current matching.

Note that the graph is therefore just a long path. Due to the renaming, the indices of may not reflect the order of arrivals.

At time (), the adversary reveals two edges and . The algorithm then has only three options: (a) do nothing; (b) add to the matching; (c) add to the matching. For the last option though, in order to honor the commitment we made to vertices, we need to take the augmenting path .

If the algorithm chooses Option (a), the adversary can immediately stop: observe that the graph has a matching of cardinality , and the algorithm has already failed to output a maximum matching. If the algorithm chooses Option (b), the invariant remains satisfied, and we can proceed to the next timestep. If the algorithm chooses Option (c), we can maintain the invariant by renaming the vertices and proceed.

At time , the adversary reveals only . Option (b) therefore does not exist, and Option (c) cannot be taken since the augmenting path is too long. The algorithm is now forced to choose Option (a) and output a suboptimal matching.

Now we prove the theorem. Suppose towards contradiction that there is an algorithm that always outputs a matching of size at least for some constant and , where is the offline optimum of the graph the adversary produces. Consider an adversary that “simulates” copies of the above adversary, where is a sufficiently large integer to be chosen later. We will keep the graphs constructed by these adversaries mutually disjoint. At each time, we choose an arbitrary copy of adversary whose current matching is left-perfect. The “global” adversary reveals the vertex that this copy would reveal.

Since each copy of adversary forces the matching to be suboptimal within timesteps, within timesteps, every copy of adversary forces a suboptimal matching. By choosing , one can verify that the algorithm finds a matching of cardinality no greater than since . ∎

Now we consider the edge-arrival model against adaptive online adversaries. Note that this immediately implies the same lower bound against adaptive offline adversaries.

###### Theorem 8 (restated).

For all constant , no randomized algorithm is -competitive against an adaptive online adversary for the maximum-cardinality online matching problem under edge arrivals with a hard budget of on the number of reassignments.

###### Proof.

Let denote the cardinality of the online solution produced by the adversary. Suppose towards contradiction that there is a randomized online algorithm that outputs a matching whose expected cardinality is at least for some constant .

Now consider the following adversary. The adversary chooses the number of vertices as for some sufficiently large integer . In the first timesteps, it reveals an edge that is disjoint from all of the previously revealed edges; the adversary does not include these edges in its solution. At the end of time , the graph will contain vertices of degree one and of degree zero. Let be the set of edges revealed so far and be the set of the vertices of zero degree. We will show later that the edges in are the only edges the algorithm can ever add to the matching, and once the algorithm adds an edge in , the edge will never leave the matching.

The adversary then selects edges in the current matching output by the algorithm. (If the algorithm chose fewer than edges, the adversary immediately stops at this point.) Let us call the selected edges . The adversary now reveals edges (over timesteps, of course) so that they together with the selected edges form an augmenting path of length between two vertices from . To be precise, the adversary reveals the edges , one by one, for some . These new edges are all included in the adversary’s solution. Once this is done, the adversary again selects new edges in the algorithm’s current matching and repeat this process. The adversary does not select an edge that was selected before (and a path containing it has been created) again; likewise, the two endpoints and will always be selected “fresh” from . The adversary stops when there remain fewer than edges in the matching that were not previously selected. We remark that the fresh choice of and is always possible because . We also note that, during this process, some edges in that was not added to the matching during the first timesteps may newly enter the matching, but in any case, there will remain fewer than unselected matching edges when the adversary stops.

At any point of time, if the algorithm wants to remove some edge from the matching, then it needs to honor the commitment that its endpoints will remain matched. Due to the adversary’s construction, this enforces the algorithm to choose the entire augmenting path of length . Similarly, if the algorithm wants to add to the matching any edge outside , it is again required to choose the entire augmenting path of length . Neither is possible because they involve (re)assignments. This proves our earlier claim that the algorithm can only add the edges in to the matching, and that once an edge enters the matching it will never leave.

Let us now bound . Since we can consider an imaginary adversary that adds the first edges to its solution and stops immediately after time , the algorithm must choose at least edges from in expectation by the end of time , even against the given adversary. Let be the number of edges that are output by the algorithm at the end. The graph contains at least paths and hence we have . For , we have from . ∎

## 4 Weighted Case

### 4.1 Analysis

In this section, we present the analysis of the given algorithm under the weighted model. Note that we do not assume triangle inequality; only the nonnegativity is required.

###### Theorem 3 (restated).

The given algorithm is a -competitive algorithm for the maximum-weight online bipartite left-perfect matching problem with general weights under vertex arrivals with a hard budget on the number of reassignments.

#### Notation and Definitions.

Let be a complete bipartite graph, and be the edge weights. Let denote the vertex that arrives at time and be the number of timesteps. The algorithm is given (and ) in advance. Since the model requires the algorithm to output a left-perfect matching, we have .

Let be the matching that the algorithm maintains at the beginning of time , i.e., one that the algorithm outputs at time . Let be the exposed vertices in at the beginning of time . Here, the beginning of time indicates the end of the entire execution; i.e., is the final left-perfect matching the algorithm produces. Given a matching in , we slightly abuse the notation to let denote the vertex with which is matched by .

Let denote the marginal profit that the algorithm achieves at time , i.e., for . Fahrbach and Zadimoghaddam [16] uses this marginal profit (or marginal gain) to analyze an online algorithm for the weighted problem under the free disposal model.

Suppose that, at time , the algorithm augments the matching at the path . This implies that and . Since the algorithm chose over to be matched with , we have . Thus, swapping out with incurs the loss of but is large enough to cover this loss. Let us define the loss from vertex at time , denoted by , to be the loss that would incur if the algorithm decides to take away from and needs to find a new match: i.e.,

 ℓtv:=⎧⎨⎩w(Mt(v),v)−maxv′∈Rtexpw(Mt(v),v′),if v is matched at the % beginning of time t,0,otherwise,

where .

The following lemma bounds the marginal profit of each timestep. Let be a maximum-weight left-perfect matching in .

###### Lemma 13.

For each timestep , we have .

###### Proof.

Let be the vertex to which is matched by the optimal left-perfect matching. Observe that the right-hand side of the inequality represents the profit of matching to at time : if is exposed at the beginning of time , the algorithm can simply add to the matching, obtaining the profit of . Otherwise, the algorithm can profit at most if it swaps out , matches somewhere else, and adds to the matching. Recall that the algorithm finds the most profitable augmenting path of length at most 3 at each timestep. ∎

Now we show the monotonicity of the loss from each vertex over time.

###### Lemma 14.

For each , is non-decreasing over .

###### Proof.

Suppose that newly becomes matched at time . Since is exposed at the beginning of this timestep, we have by definition. If , this implies there is such that . However, since is also exposed at the beginning of time , the algorithm would not have chosen over to match with . This shows .

Now suppose that was matched at the beginning of time . Since every vertex will never become exposed once it is matched, we have . Therefore, if does not participate in the augmenting path chosen by the algorithm at time and hence , we can easily see that .

The only remaining case is when is on the augmenting path the algorithm adopts at time . Let denote this path, where is an exposed vertex in at the beginning of time . Observe that by construction of the algorithm.

Let us assume for now that . Let . Note that is also exposed at the beginning of time , implying that the algorithm could have directly matched with , but chose to use at time . We thus have

 w(ut,v)−w(Mt(v),v)+w(Mt(v),vtail)≥w(ut,vmax),

yielding , where the first equality comes from that is the vertex where is matched by .

Observe that only if . In this case, since could have been directly matched with , we have . This gives

We are now ready to prove Theorem 3.

###### Proof of Theorem 3.

Let be the left-perfect matching the algorithm produces at the end. From Lemma 13, we have

 n∑t=1pt+n∑t=1ℓtM⋆(ut)≥n∑t=1w(ut,M⋆(ut))=∑e∈M⋆w(e). (1)

Observe that, by the definition of , we have

 n∑t=1pt=∑e∈Mw(e). (2)

Moreover, by Lemma 14, we can derive

 n∑t=1ℓtM⋆(ut)≤n∑t=1ℓn+1M⋆(ut)≤∑e∈Mw(e), (3)

where the last inequality comes from the fact that is a left-perfect matching. Combining (1)–(3) gives . ∎

### 4.2 Lower Bound

In this section, we present the lower bound under the weighted model.

###### Theorem 4 (restated).

For all constant , no deterministic algorithm is -competitive for the maximum-weight online bipartite left-perfect matching problem under vertex arrivals with , even when all edge weights are either or .

Let be a sufficiently large number. The adversary will construct a graph with ; it reveals the graph at each timestep as we describe below. Let denote the vertex that arrives at time . On the way, the adversary will name the vertices in from to , although this does not necessarily relate with .

Phase 1. At time , the adversary reveals only zero-weight edges, i.e., for every vertex . Let be the vertex that got matched by the algorithm at time .

Phase 2. At time , the adversary selects a vertex in to be named : if there exists a vertex in that is matched by the algorithm at the beginning of time , it selects that vertex as ; otherwise, it selects an arbitrary vertex from . Then, the adversary reveals the edge weights as follows: and for all other .

Phase 3. At time , the adversary examines what the algorithm did on the two weight-1 edges incident with , i.e., and . If one of these two edges is in the matching at the beginning of time , the adversary renames these two vertices so that is the edge in the matching: is not in the matching. Then, the adversary reveals the edge weights as follows: and for all other .

###### Observation 15.

Suppose that, at some point of time, an edge is not in the matching but both and are matched. Then, this edge cannot enter the matching for the rest of the algorithm’s execution.

###### Proof.

In order to add to the matching, we need to remove the two edges in the matching incident with and . We must honor the commitments we made to the other endpoints of these two edges, implying that adding to the matching requires we use an augmenting path of length at least 5. Recall that the budget is . ∎

###### Lemma 16.

Against the given adversary, every online algorithm produces a perfect matching whose weight is at most .

###### Proof.

By construction, are all matched by the end of Phase 1. For , we can show by induction on that, at the beginning of time , there can be at most one vertex in that is matched. This implies that at most one vertex in is exposed at the end of time . Let and we have .

Now consider an arbitrary timestep . Note that both and are matched at the beginning of time . We now claim that at most one of the three edges can be in the matching at the end of time .

If at least one of and is in the matching, it must be due to the renaming. Since is not in the matching at the beginning of time , Observation 15 implies that can never enter the matching for the rest of the algorithm’s execution. On the other hand, since and share an endpoint, at most one of them can be in the matching, proving the claim.

Now suppose that neither nor is in the matching. Observation 15 implies that these two edges can never enter the matching, proving the claim again.

Note that are mutually disjoint for , and these are the only edges with weight 1. On the other hand, for all , at most one edge in can be in the final matching. Since , this shows that the perfect matching output by the algorithm at the end of the execution has weight at most . ∎

###### Proof of Theorem 4.

Note that the graph constructed by the adversary has matching of weight : choose and for all . The desired conclusion immediately follows from Lemma 16 by choosing a sufficiently large . ∎

## References

• [1] Gagan Aggarwal, Gagan Goel, Chinmay Karande, and Aranyak Mehta. Online vertex-weighted bipartite matching and single-bid budgeted allocations. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1253–1264. SIAM, 2011.
• [2] Spyros Angelopoulos, Christoph Dürr, and Shendan Jin. Online maximum matching with recourse. In 43rd International Symposium on Mathematical Foundations of Computer Science (MFCS), volume 117, pages 8:1–8:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018.
• [3] T. Avitabile, C. Mathieu, and L. Parkinson. Online constrained optimization with recourse. Information Processing Letters, 113(3):81–86, 2013.
• [4] Nikhil Bansal, Niv Buchbinder, Anupam Gupta, and Joseph Naor. A randomized -competitive algorithm for metric bipartite matching. Algorithmica, 68(2):390–403, 2014.
• [5] Shai Ben-David, Allan Borodin, Richard M. Karp, Gábor Tardos, and Avi Wigderson. On the power of randomization in on-line algorithms. Algorithmica, 11(1):2–14, 1994.
• [6] Aaron Bernstein, Jacob Holm, and Eva Rotenberg. Online bipartite matching with amortized replacements. Journal of the ACM, 66(5):37:1–37:23, 2019.
• [7] Aaron Bernstein, Tsvi Kopelowitz, Seth Pettie, Ely Porat, and Clifford Stein. Simultaneously load balancing for every -norm, with reassignments. In 8th Innovations in Theoretical Computer Science Conference (ITCS), volume 67, pages 51:1–51:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017.
• [8] Benjamin E. Birnbaum and Claire Mathieu. On-line bipartite matching made simple. SIGACT News, 39(1):80–87, 2008.
• [9] Bartlomiej Bosek, Dariusz Leniowski, Piotr Sankowski, and Anna Zych. Online bipartite matching in offline time. In 55th IEEE Annual Symposium on Foundations of Computer Science (FOCS), pages 384–393. IEEE Computer Society, 2014.
• [10] Bartlomiej Bosek, Dariusz Leniowski, Piotr Sankowski, and Anna Zych-Pawlewicz. A tight bound for shortest augmenting paths on trees. In 13th Latin American Symposium on Theoretical Informatics (LATIN), volume 10807, pages 201–216. Springer, 2018.
• [11] Joan Boyar, Lene M. Favrholdt, Michal Kotrbčík, and Kim S. Larsen. Relaxing the irrevocability requirement for online graph algorithms. In 15th International Symposium on Algorithms and Data Structures (WADS), volume 10389, pages 217–228. Springer, 2017.
• [12] Brian Brubach, Karthik Abinav Sankararaman, Aravind Srinivasan, and Pan Xu. New algorithms, better bounds, and a novel model for online stochastic matching. In 24th Annual European Symposium on Algorithms (ESA), volume 57, pages 24:1–24:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2016.
• [13] Kamalika Chaudhuri, Constantinos Daskalakis, Robert D. Kleinberg, and Henry Lin. Online bipartite perfect matching with augmentations. In 28th IEEE International Conference on Computer Communications (INFOCOM), pages 1044–1052. IEEE, 2009.
• [14] Nikhil R. Devanur, Kamal Jain, and Robert D. Kleinberg. Randomized primal-dual analysis of RANKING for online bipartite matching. In Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 101–107. SIAM, 2013.
• [15] Leah Epstein, Asaf Levin, Danny Segev, and Oren Weimann. Improved bounds for randomized preemptive online matching. Information and Computation, 259(1):31–40, 2018.
• [16] Matthew Fahrbach and Morteza Zadimoghaddam. Online weighted matching: Beating the 1/2 barrier. CoRR, abs/1704.05384, 2019.
• [17] Jon Feldman, Nitish Korula, Vahab S. Mirrokni, S. Muthukrishnan, and Martin Pál. Online ad assignment with free disposal. In 5th International Workshop on Internet and Network Economics (WINE), volume 5929, pages 374–385. Springer, 2009.
• [18] Jon Feldman, Aranyak Mehta, Vahab S. Mirrokni, and S. Muthukrishnan. Online stochastic matching: Beating 1-1/e. In 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 117–126. IEEE Computer Society, 2009.
• [19] Buddhima Gamlath, Sagar Kale, and Ola Svensson. Beating greedy for stochastic bipartite matching. In Proceedings of the 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2841–2854. SIAM, 2019.
• [20] Buddhima Gamlath, Michael Kapralov, Andreas Maggiori, Ola Svensson, and David Wajc. Online matching with general arrivals. In 60th IEEE Annual Symposium on Foundations of Computer Science (FOCS), pages 26–37. IEEE Computer Society, 2019.
• [21] Gagan Goel and Aranyak Mehta. Online budgeted matching in random input models with applications to adwords. In Proceedings of the 19th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 982–991. SIAM, 2008.
• [22] Edward F. Grove, Ming-Yang Kao, P. Krishnan, and Jeffrey Scott Vitter. Online perfect matching and mobile computing. In 4th International Workshop on Algorithms and Data Structures (WADS), volume 955, pages 194–205. Springer, 1995.
• [23] Anupam Gupta, Guru Guruganesh, Binghui Peng, and David Wajc. Stochastic online metric matching. In 46th International Colloquium on Automata, Languages, and Programming (ICALP), volume 132, pages 67:1–67:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019.
• [24] Anupam Gupta, Amit Kumar, and Cliff Stein. Maintaining assignments online: Matching, scheduling, and flows. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 468–479. SIAM, 2014.
• [25] Bernhard Haeupler, Vahab S. Mirrokni, and Morteza Zadimoghaddam. Online stochastic weighted matching: Improved approximation algorithms. In 7th International Workshop on Internet and Network Economics (WINE), volume 7090, pages 170–181. Springer, 2011.
• [26] John E. Hopcroft and Richard M. Karp. An algorithm for maximum matchings in bipartite graphs. SIAM Journal on Computing, 2(4):225–231, 1973.
• [27] Zhiyi Huang. Understanding Zadimoghaddam’s edge-weighted online matching algorithm: Weighted case. CoRR, abs/1910.03287, 2019.
• [28] Zhiyi Huang, Ning Kang, Zhihao Gavin Tang, Xiaowei Wu, Yuhao Zhang, and Xue Zhu. How to match when all vertices arrive online. In

Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing (STOC)

, pages 17–29. ACM, 2018.
• [29] Zhiyi Huang, Binghui Peng, Zhihao Gavin Tang, Runzhou Tao, Xiaowei Wu, and Yuhao Zhang. Tight competitive ratios of classic matching algorithms in the fully online model. In Proceedings of the 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2875–2886. SIAM, 2019.
• [30] Zhiyi Huang, Zhihao Gavin Tang, Xiaowei Wu, and Yuhao Zhang. Online vertex-weighted bipartite matching: Beating 1-1/e with random arrivals. In 45th International Colloquium on Automata, Languages, and Programming (ICALP), volume 107, pages 79:1–79:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018.
• [31] Bala Kalyanasundaram and Kirk Pruhs. Online weighted matching. Journal of Algorithms, 14(3):478–488, 1993.
• [32] Richard M. Karp, Umesh V. Vazirani, and Vijay V. Vazirani. An optimal algorithm for on-line bipartite matching. In Proceedings of the 22nd Annual ACM Symposium on Theory of Computing (STOC), pages 352–358. ACM, 1990.
• [33] Thomas Kesselheim, Klaus Radke, Andreas Tönnis, and Berthold Vöcking. An optimal online algorithm for weighted bipartite matching and extensions to combinatorial auctions. In 21st Annual European Symposium on Algorithms (ESA), volume 8125, pages 589–600. Springer, 2013.
• [34] Samir Khuller, Stephen G. Mitchell, and Vijay V. Vazirani. On-line algorithms for weighted bipartite matching and stable marriages. In 18th International Colloquium on Automata, Languages, and Programming (ICALP), volume 510, pages 728–738. Springer, 1991.
• [35] Nitish Korula, Vahab S. Mirrokni, and Morteza Zadimoghaddam. Bicriteria online matching: Maximizing weight and cardinality. In 9th International Conference on Web and Internet Economics (WINE), volume 8289, pages 305–318. Springer, 2013.
• [36] Vahideh H. Manshadi, Shayan Oveis Gharan, and Amin Saberi. Online stochastic matching: Online actions based on offline statistics. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1285–1294. SIAM, 2011.
• [37] Aranyak Mehta, Amin Saberi, Umesh V. Vazirani, and Vijay V. Vazirani. Adwords and generalized online matching. Journal of the ACM, 54(5):22, 2007.

Online stochastic matching with unequal probabilities.

In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1388–1404. SIAM, 2015.
• [39] Adam Meyerson, Akash Nanavati, and Laura J. Poplawski. Randomized online algorithms for minimum metric bipartite matching. In Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 954–959. ACM Press, 2006.
• [40] Sharath Raghvendra. A robust and optimal online algorithm for minimum metric bipartite matching. In

Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM)

, volume 60, pages 18:1–18:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2016.
• [41] Yajun Wang and Sam Chiu-wai Wong. Two-sided online bipartite matching and vertex cover: Beating the greedy algorithm. In 42nd International Colloquium on Automata, Languages, and Programming (ICALP), volume 9134, pages 1070–1081. Springer, 2015.

## Appendix A Deferred Proofs

###### Observation 17.

For the maximum-cardinality online bipartite matching problem under vertex arrivals with a hard budget , there exists an instance where the matching output by the given algorithm contains an augmenting path of length no greater than .

###### Proof.

Let . Consider the following scenario with timesteps. Let denote the vertex that arrives at time , and be the matching that the algorithm outputs at the end of time . We will number the vertices in as follows: .

1. For each time , edges and are revealed. Assume the algorithm matches to at each time.

2. At time , edge is revealed. Observe that the algorithm cannot match since the only augmenting path starting with with respect to has length . We thus have .

3. At time , edges and are revealed. Suppose the algorithm chooses an augmenting path of length . Note that for .

We can now verify that there is an augmenting path with respect to of length 5. Recall that since is an even number greater than . ∎

###### Theorem 5 (restated).

The given algorithm is a -competitive algorithm for the maximum-cardinality online matching problem under edge arrivals with a hard budget of on the number of reassignments.

###### Proof.

We claim that the length of every augmenting path is at least at the end of each timestep. The conclusion then follows from Lemma 10.

Use induction on time . We define the matching at the end of “time 0” as the empty set; then the base case is trivial. Fix a timestep , and let us define and be the graph at time and , respectively. Let denote the matching that is output by the algorithm at the end of time , and be the edge that arrives at time . The length of any augmenting path in with respect to is at least from the induction hypothesis.

If the algorithm does nothing at time , this happens because every augmenting path in containing with respect to has length at least . Suppose towards contradiction that there is an augmenting path in with respect to of length less than . Then this path does not contain and is an augmenting path in , contradicting the induction hypothesis.

The remaining case is when the algorithm uses a shortest augmenting path to output a new matching at the end of time . Let be an arbitrary augmenting path with respect to . Let and be the augmenting paths in with respect to satisfying the conditions of Lemma 11. Due to Condition 1, at most one of and contains . Suppose without loss of generality that . This implies that is an augmenting path in with respect to , yielding . On the other hand, no matter whether contains or not, we have since is a shortest augmenting path containing whose length is no more than . By Condition 2 of Lemma 11, we have , completing the proof. ∎