Online Matching with General Arrivals

by   Buddhima Gamlath, et al.
Carnegie Mellon University

The online matching problem was introduced by Karp, Vazirani and Vazirani nearly three decades ago. In that seminal work, they studied this problem in bipartite graphs with vertices arriving only on one side, and presented optimal deterministic and randomized algorithms for this setting. In comparison, more general arrival models, such as edge arrivals and general vertex arrivals, have proven more challenging and positive results are known only for various relaxations of the problem. In particular, even the basic question of whether randomization allows one to beat the trivially-optimal deterministic competitive ratio of 1/2 for either of these models was open. In this paper, we resolve this question for both these natural arrival models, and show the following. 1. For edge arrivals, randomization does not help --- no randomized algorithm is better than 1/2 competitive. 2. For general vertex arrivals, randomization helps --- there exists a randomized (1/2+Ω(1))-competitive online matching algorithm.


Secretary Matching with General Arrivals

We provide online algorithms for secretary matching in general weighted ...

Improved Bounds for Fractional Online Matching Problems

Online bipartite matching with one-sided arrival and its variants have b...

Online Mincut: Advice, Randomization and More

In this paper we study the mincut problem on connected graphs in the onl...

Online B-Matchings for Reconfigurable Datacenters: The Power of Randomization

This paper studies the problem of how to dynamically optimize the topolo...

A negative dependence framework to assess different forms of scrambling

We use the framework of dependence to assess the benefits of scrambling ...

Tight Bounds for Online Matching in Bounded-Degree Graphs with Vertex Capacities

We study the b-matching problem in bipartite graphs G=(S,R,E). Each vert...

Formal Barriers to Simple Algorithms for the Matroid Secretary Problem

Babaioff et al. [BIK2007] introduced the matroid secretary problem in 20...

1 Introduction

Matching theory has played a prominent role in the area of combinatorial optimization, with many applications

[21, 23]. Moreover, many fundamental techniques and concepts in combinatorial optimization can trace their origins to its study, including the primal-dual framework [19], proofs of polytopes’ integrality beyond total unimodularity [8], and even the equation of efficiency with polytime computability [9].

Given the prominence of matching theory in combinatorial optimization, it comes as little surprise that the maximum matching problem was one of the first problems studied from the point of view of online algorithms and competitive analysis. In 1990, Karp, Vazirani, and Vazirani [18] introduced the online matching problem, and studied it under one-sided bipartite arrivals. For such arrivals, Karp et al. noted that the trivial -competitive greedy algorithm (which matches any arriving vertex to an arbitrary unmatched neighbor, if one exists) is optimal among deterministic algorithms for this problem. More interestingly, they provided an elegant randomized online algorithm for this problem, called ranking, which achieves an optimal competitive ratio. (This bound has been re-proven many times over the years [2, 13, 6, 7, 11].) Online matching and many extensions of this problem under one-sided bipartite vertex arrivals were widely studied over the years, both under adversarial and stochastic arrival models. See recent work [15, 17, 16, 5] and the excellent survey of Mehta [22] for further references on this rich literature.

Despite our increasingly better understanding of one-sided online bipartite matching and its extensions, the problem of online matching under more general arrival models, including edge arrivals and general vertex arrivals, has remained staunchly defiant, resisting attacks. In particular, the basic questions of whether the trivial competitive ratio is optimal for the adversarial edge-arrival and general vertex-arrival models have remained tantalizing open questions in the online algorithms literature. In this paper, we answer both of these questions.

1.1 Prior Work and Our Results

Here we outline the most relevant prior work, as well as our contributions. Throughout, we say an algorithm (either randomized or fractional) has competitive ratio , or equivalently is -competitive, if the ratio of the algorithm’s value (e.g., expected matching size, or overall value, ) to OPT is at least for all inputs and arrival orders. As is standard in the online algorithms literature on maximization problems, we use upper bounds (on ) to refer to hardness results, and lower bounds to positive results.

Edge Arrivals.

Arguably the most natural, and the least restricted, arrival model for online matching is the edge arrival model. In this model, edges are revealed one by one, and an online matching algorithm must decide immediately and irrevocably whether to match the edge on arrival, or whether to leave both endpoints free to be possibly matched later.

On the hardness front, the problem is known to be strictly harder than the one-sided vertex arrival model of Karp et al. [18], which admits a competitive ratio of . In particular, Epstein et al. [10] gave an upper bound of for this problem, recently improved by Huang et al. [16] to . (Both bounds apply even to online algorithms with preemption; i.e., allowing edges to be removed from the matching in favor of a newly-arrived edge.) On the positive side, as pointed out by Buchbinder et al. [3], the edge arrival model has proven challenging, and results beating the competitive ratio were only achieved under various relaxations, including: random order edge arrival [14], bounded number of arrival batches [20], on trees, either with or without preemption [24, 3], and for bounded-degree graphs [3]. The above papers all asked whether there exists a randomized -competitive algorithm for adversarial edge arrivals (see also Open Question 17 in Mehta’s survey [22]).

In this work, we answer this open question, providing it with a strong negative answer. In particular, we show that no online algorithm for fractional matching (i.e., an algorithm which immediately and irrevocably assigns values to edge upon arrival such that is in the fractional matching polytope ) is better than competitive. As any randomized algorithm induces a fractional algorithm with the same competitive ratio, this rules out any randomized online matching algorithm which is better than deterministic algorithms.

Theorem 1.1.

No fractional online algorithm is competitive for online matching under adversarial edge arrivals, even in bipartite graphs.

This result shows that the study of relaxed variants of online matching under edge arrivals is not only justified by the difficulty of beating the trivial bound for this problem, but rather by its impossibility.

General Vertex Arrivals.

In the online matching problem under vertex arrivals, vertices are revealed one at a time, together with their edges to their previously-revealed neighbors. An online matching algorithm must decide immediately and irrevocably upon arrival of a vertex whether to match it (or keep it free for later), and if so, who to match it to. The one-sided bipartite problem studied by Karp et al. [18] is precisely this problem when all vertices of one side of a bipartite graph arrive first. As discussed above, for this one-sided arrival model, the problem is thoroughly understood (even down to lower-order error terms [11]). Wang and Wong [25] proved that general vertex arrivals are strictly harder than one-sided bipartite arrivals, providing an upper bound of for the more general problem, later improved by Buchbinder et al. [3] to . Clearly, the general vertex arrival model is no harder than the online edge arrival model but is it easier? The answer is “yes” for fractional algorithms, as shown by combining our creftypecap 1.1 with the -competitive fractional online matching algorithm under general vertex arrivals of Wang and Wong [25]. For integral online matching, however, the problem has proven challenging, and the only positive results for this problem, too, are for various relaxations, such as restriction to trees, either with or without preemption [24, 4, 3], for bounded-degree graphs [3], or (recently) allowing vertices to be matched during some known time interval [15, 16].

We elaborate on the last relaxation above. In the model recently studied by Huang et al. [15, 16] vertices have both arrival and departure times, and edges can be matched whenever both their endpoints are present. (One-sided vertex arrivals is a special case of this model with all online vertices departing immediately after arrival and offline vertices departing at .) We note that any -competitive online matching under general vertex arrivals is -competitive in the less restrictive model of Huang et al. As observed by Huang et al., for their model an optimal approach might as well be greedy; i.e., an unmatched vertex should always be matched at its departure time if possible. In particular, Huang et al. [15, 16], showed that the ranking algorithm of Karp et al. is optimal in this model, giving a competitive ratio of . For general vertex arrivals, however, ranking (and indeed any maximal matching algorithm) is no better than competitive, as is readily shown by a path on three edges with the internal vertices arriving first. Consequently, new ideas and algorithms are needed.

The natural open question for general vertex arrivals is whether a competitive ratio of is achievable by an integral randomized algorithm, without any assumptions (see e.g., [25]). In this work, we answer this question in the affirmative:

Theorem 1.2.

There exists a -competitive randomized online matching algorithm for general adversarial vertex arrivals.

1.2 Our Techniques

Edge Arrivals.

All prior upper bounds in the online literature [18, 10, 16, 3, 11] can be rephrased as upper bounds for fractional algorithms; i.e., algorithms which immediately and irrevocably assign each edge a value on arrival, so that is contained in the fractional matching polytope, . With the exception of [3], the core difficulty of these hard instances is uncertainty about “identity” of vertices (in particular, which vertices will neighbor which vertices in the following arrivals). Our hardness instances rely on uncertainty about the “time horizon”. In particular, the underlying graph, vertex identifiers, and even arrival order are known to the algorithm, but the number of edges of the graph to be revealed (to arrive) is uncertain. Consequently, an -competitive algorithm must accrue high enough value up to each arrival time to guarantee a high competitive ratio at all points in time. As we shall show, for competitive ratio

, this goal is at odds with the fractional matching constraints, and so such a competitive ratio is impossible. In particular, we provide a family of hard instances and formulate their prefix-competitiveness and matching constraints as linear constraints to obtain a linear program whose objective value bounds the optimal competitive ratio. Solving the obtained LP’s dual, we obtain by weak duality the claimed upper bound on the optimal competitive ratio.

General Vertex Arrivals.

Our high-level approach here will be to round online a fractional online matching algorithm’s output, specifically that of Wang and Wong [25]. While this approach sounds simple, there are several obstacles to overcome. First, the fractional matching polytope is not integral in general graphs, where a fractional matching may have value, , some times larger than the optimal matching size. (For example, in a triangle graph with value for each edge .) Therefore, any general rounding scheme must lose a factor of on the competitive ratio compared to the fractional algorithm’s value, and so to beat a competitive ratio of would require an online fractional matching with competitive ratio , which is impossible. To make matters worse, even in bipartite graphs, for which the fractional matching polytope is integral and offline lossless rounding is possible [1, 12], online lossless rounding of fractional matchings is impossible, even under one-sided vertex arrivals [5].

Despite these challenges, we show that a slightly better than -competitive fractional matching computed by the algorithm of [25] can be rounded online without incurring too high a loss, yielding -competitive randomized algorithm for online matching under general vertex arrivals.

To outline our approach, we first consider a simple method to round matchings online. When vertex arrives, we pick an edge

with probability

, and add it to our matching if is free.

If , this allows us to pick at most one edge per vertex and have each edge be in our matching with the right marginal probability, , resulting in a lossless rounding. Unfortunately, we know of no better-than--competitive fractional algorithm for which this rounding guarantees .

However, we observe that, for the correct set of parameters, the fractional matching algorithm of Wang and Wong [25] makes close to one, while still ensuring a better-than--competitive fractional solution. Namely, as we elaborate later in Section 3.3, we set the parameters of their algorithm so that , while retaining a competitive ratio of . Now consider the same rounding algorithm with normalized probabilities: I.e., on ’s arrival, sample a neighbor with probability and match if is free. As the sum of ’s is slightly above one in the worst case, this approach does not drastically reduce the competitive ratio. But the normalization factor is still too significant compared to the competitive ratio of the fractional solution, driving the competitive ratio of the rounding algorithm slightly below .

To account for this minor yet significant loss, we therefore augment the simple algorithm by allowing it, with small probability (e.g., say ), to sample a second neighbor for each arriving vertex , again with probabilities proportional to : If the first sampled choice, , is free, we match to . Otherwise, if the second choice, , is free, we match to . What is the marginal probability that such an approach matches an incoming vertex to a given neighbor ? Letting denote the event that is free when arrives, this probability is precisely


Here the first term in the parentheses corresponds to the probability that matches to via the first choice, and the second term corresponds to the same happening via the second choice (which is only taken when the first choice fails).

Ideally, we would like (1) to be at least for all edges, which would imply a lossless rounding. However, as mentioned earlier, this is difficult and in general impossible to do, even in much more restricted settings including one-sided bipartite vertex arrivals. We therefore settle for showing that (1) is at least for most edges (weighted by ). Even this goal, however, is challenging and requires a nontrivial understanding of the correlation structure of the random events . To see this, note that for example if the events are perfectly positively correlated, i.e., , then the possibility of picking as a second edge does not increase this edge’s probability of being matched at all compared to if we only picked a single edge per vertex. This results in being matched with probability , which does not lead to any gain over the competitive ratio of greedy. Such problems are easily shown not to arise if all variables are independent or negatively correlated. Unfortunately, positive correlation does arise from this process, and so we the need to control these positive correlations.

The core of our analysis is therefore dedicated to showing that even though positive correlations do arise, they are by and large rather weak. Our main technical contribution consists of developing techniques for bounding such positive correlations. The idea behind the analysis is to consider the primary choices and secondary choices of vertices as defining a graph, and showing that after a natural pruning operation that reflects the structure of dependencies, most vertices are most often part of a very small connected component in the graph. The fact that connected components are typically very small is exactly what makes positive correlations weak and results in the required lower bound on (1) for most edges (in terms of -value), which in turn yields our competitive ratio.

2 Edge Arrivals

In this section we prove the asymptotic optimality of the greedy algorithm for online matching under adversarial edge arrivals. As discussed briefly in Section 1, our main idea will be to provide a “prefix hardness” instance, where an underlying input and the arrival order is known to the online matching algorithm, but the prefix of the input to arrive (or “termination time”) is not. Consequently, the algorithm must accrue high enough value up to each arrival time, to guarantee a high competitive ratio at all points in time. As we show, the fractional matching constraints rule out a competitive ratio of even in this model where the underlying graph is known.

Theorem 2.1.

There exists an infinite family of bipartite graphs with maximum degree and edge arrival order for which any online matching algorithm is at best -competitive.


We will provide a family of graphs for which no fractional online matching algorithm has better competitive ratio. Since any randomized algorithm induces a fractional matching algorithm, this immediately implies our claim. The graph of the family, , consists of a bipartite graph with vertices on either side. We denote by and the node on the left and right side of , respectively. Edges are revealed in discrete rounds. In round , the edges of a perfect matching between the first left and right vertices arrive in some order. I.e., a matching of and is revealed. Specifically, edges for all arrive. (See Figure 1 for example.) Intuitively, the difficulty for an algorithm attempting to assign much value to edges of is that the (unique) maximum matching changes every round, and no edge ever re-enters .

round 1

round 2

round 3

round 4

round 5
Figure 1: , together with arrival order. Edges of current (prior) round are solid (dashed).

Consider some -competitive fractional algorithm . We call the edge of a vertex in the (unique) maximum matching of the subgraph of following round the edge of . For , denote by the value assigns to the edge of vertex (and of ); i.e., to . By feasibility of the fractional matching output by , we immediately have that for all , as well as the following matching constraints for and . (For the latter, note that the edge of is assigned value and so the edge of is assigned value ).


On the other hand, as is -competitive, we have that after some round – when the maximum matching has cardinality – algorithm ’s fractional matching must have value at least . (Else an adversary can stop the input after this round, leaving with a worse than -competitive matching.) Consequently, we have the following competitiveness constraints.


Combining constraints (2), (3) and (4) together with the non-negativity of the yields the following linear program, LP(), whose optimal value upper bounds any fractional online matching algorithm’s competitiveness on , by the above.

subject to:

To bound the optimal value of LP(), we provide a feasible solution its LP dual, which we denote by Dual(). By weak duality, any dual feasible solution’s value upper bounds the optimal value of LP(), which in turn upper bounds the optimal competitive ratio. Using the dual variables for the degree constraints of the left and right vertices respectively ( and ) and dual variable for the competitiveness constraint of the round, we get the following dual linear program. Recall here again that appears in the matching constraint of , with dual variable , and so appears in the same constraint for .)

subject to:

We provide the following dual solution.

We start by proving feasibility of this solution. The first constraint is satisfied with equality. For the second constraint, as it suffices to show that for all . Note that if , then . So, for all we have . Consequently, for all . Non-negativity of the variables is trivial, and so we conclude that the above is a feasible dual solution.

It remains to calculate this dual feasible solution’s value. We do so for even,333The case of odd is similar. As it is unnecessary to establish the result of this theorem, we omit it. for which

completing the proof. ∎

Remark 1. Recall that Buchbinder et al. [3] and Lee and Singla [20] presented better-than--competitive algorithms for bounded-degree graphs and bounded number of arrival batches. Our upper bound above shows that a deterioration of the competitive guarantees as the maximum degree and number of arrival batches increase (as in the algorithms of [3, 20]) is inevitable.

Remark 2. Recall that the asymptotic competitive ratio of an algorithm is the maximum such that the algorithm always guarantees value at least for some fixed . Our proof extends to this weaker notion of competitiveness easily, by revealing multiple copies of the hard family of creftypecap 2.1 and letting denote the average of its counterparts over all copies.

3 General Vertex Arrivals

In this section we present a -competitive randomized algorithm for online matching under general arrivals. As discussed in the introduction, our approach will be to round (online) a fractional online matching algorithm’s output. Specifically, this will be an algorithm from the family of fractional algorithms introduced in [25]. In Section 3.1 we describe this family of algorithms. To motivate our rounding approach, in Section 3.2 we first present a simple lossless rounding method for a -competitive algorithm in this family. In Section 3.3 we then describe our rounding algorithm for a better-than--competitive algorithm in this family. Finally, in Section 3.4 we analyze this rounding scheme, and show that it yields a -competitive algorithm.

3.1 Finding a fractional solution

In this section we revisit the algorithm of Wang and Wong [25], which beats the competitiveness barrier for online fractional matching under general vertex arrivals. Their algorithm (technically, family of algorithms) applies the primal-dual method to compute both a fractional matching and a fractional vertex cover – the dual of the fractional matching relaxation. The LPs defining these dual problems are as follows.


subject to:

Dual-Vertex Cover

subject to:

Before introducing the algorithm of [25], we begin by defining the fractional online vertex cover problem for vertex arrivals. When a vertex arrives, if denotes the previously-arrived neighbors of , then for each , a new constraint is revealed, which an online algorithm should satisfy by possibly increasing or . Suppose has its dual value set to . Then all of its neighbors should have their dual increased to at least . Indeed, an algorithm may as well increase to . The choice of therefore determines an online fractional vertex cover algorithm. The increase of potential due to the newly-arrived vertex is thus .444Here and throughout the paper, we let for all . In [25] is chosen to upper bound this term by for some function . The primal solution (fractional matching) assigns values so as to guarantee feasibility of and a ratio of between the primal and dual values of and , implying -competitiveness of this online fractional matching algorithm, by feasibility of and weak duality. The algorithm, parameterized by a function and parameter to be discussed below, is given formally in Algorithm 1. In the subsequent discussion, denotes the set of neighbors of that arrive before .

Input : A stream of vertices . At step , vertex and are revealed.
Output : A fractional vertex cover solution and a fractional matching .
1 Let for all , let for all . foreach  in the stream do
subject to:
foreach  do
3             .
4      .
Algorithm 1 Online general vertex arrival fractional matching and vertex cover

Algorithm 1 is parameterized by a function and a constant . The family of functions considered by [25] are as follows.

Definition 3.1.

Let . We define .

As we will see, choices of guaranteeing feasibility of are related to the following quantity.

Definition 3.2.

For a given let .

For functions this definition of can be simplified to , due to the observation (see [25, Lemmas 4,5]) that all functions satisfy


As mentioned above, the competitiveness of Algorithm 1 for appropriate choices of and is obtained by relating the overall primal and dual values, and . As we show (and rely on later), one can even bound individual vertices’ contributions to these sums. In particular, for any vertex ’s arrival time, each vertex ’s contribution to , which we refer to as its fractional degree, , can be bounded in terms of its dual value by this point, , as follows.

Lemma 3.3.

For any vertex , let be the potential of prior to arrival of . Then the fractional degree just before arrives, , is bounded as follows:

Broadly, the lower bound on is obtained by lower bounding the increase by the increase to after each vertex arrival, while the upper bound follows from a simplification of a bound given in [25, Invariant 1] (implying feasibility of the primal solution), which we simplify using (5). See Appendix B for a full proof.

Another observation we will need regarding the functions is that they are decreasing.

Observation 3.4.

Every function is non-increasing in its argument in the range .


As observed in [25], differentiating (5) with respect to yields , from which we obtain . Replacing by , we get , or . As is positive for all , we have that for all . ∎

The next lemma of [25] characterizes the achievable competitiveness of Algorithm 1.

Lemma 3.5 ([25]).

Algorithm 1 with function and is competitive.

Wang and Wong [25] showed that taking and , Algorithm 1 is competitive. In later sections we show how to round the output of Algorithm 1 with with for some small constant and to obtain a -competitive algorithm. But first, as a warm up, we show how to round this algorithm with and .

3.2 Warmup: a -competitive randomized algorithm

In this section we will round the -competitive fractional algorithm obtained by running Algorithm 1 with function and . We will devise a lossless rounding of this fractional matching algorithm, by including each edge in the final matching with a probability equal to the fractional value assigned to it by Algorithm 1. Note that if arrives after , then if denotes the event that is free when arrives, then edge is matched by an online algorithm with probability . Therefore, to match each edge with probability , we need . That is, we must match with probability conditioned on being free. The simplest way of doing so (if possible) is to pick an edge with the above probability always, and to match it only if is free. Algorithm 2 below does just this, achieving a lossless rounding of this fractional algorithm. As before, denotes the set of neighbors of that arrive before .

Input : A stream of vertices . At step , vertex and are revealed.
Output : A matching .
1 Let for all , let for all . Let . foreach  in the stream do
2       Update ’s and ’s using Algorithm 1 with and . foreach  do
               // is as shown later
4      Sample (at most) one neighbor according to . if a free neighbor is sampled then
5             Add to .
Algorithm 2 Online vertex arrival warmup randomized fractional matching

Algorithm 2 is well defined if for each vertex ’s arrival,

is a probability distribution; i.e.,

. The following lemma asserts precisely that. Moreover, it asserts that Algorithm 2 matches each edge with the desired probability.

Lemma 3.6.

Algorithm 2 is well defined, since for every vertex on arrival, is a valid probability distribution. Moreover, for each and , it matches edge with probability .


We prove both claims in tandem for each , by induction on the number of arrivals. For the base case ( is the first arrival), the set is empty and thus both claims are trivial. Consider the arrival of a later vertex . By the inductive hypothesis we have that each vertex is previously matched with probability . But by our choice of and , if arrives after , then and at arrival of satisfy . That is, is precisely the increase in following arrival of . On the other hand, when arrived we have that its dual value increased by . To see this last step, we recall first that by definition of Algorithm 1 and our choice of , the value on arrival of is chosen to be the largest satisfying


But the inequality (6) is an equality whether or not (if , both sides are zero). We conclude that just prior to arrival of . But then, by the inductive hypothesis, this implies that (yielding an easily-computable formula for ). Consequently, by (6) we have that when arrives is a probability distribution, as

Finally, for to be matched to a latter-arriving neighbor , it must be picked and free when arrives, and so is indeed matched with probability

In the next section we present an algorithm which allows to round better-than--competitive algorithms derived from Algorithm 1.

3.3 An improved algorithm

In this section, we build on Algorithm 2 and show how to improve it to get a competitive ratio.

There are two concerns when modifying Algorithm 2 to work for a general function from the family . The first is how to compute the probability that a vertex is free when vertex arrives, in Algorithm 2. In the simpler version, we inductively showed that this probability is simply , where is the dual value of as of ’s arrival (see the proof of creftypecap 3.6). With a general function

, this probability is no longer given by a simple formula. Nevertheless, it is easily fixable: We can either use Monte Carlo sampling to estimate the probability of

being free at ’s arrival to a given inverse polynomial accuracy, or we can in fact exactly compute these probabilities by maintaining their marginal values as the algorithm progresses. In what follows, we therefore assume that our algorithm can compute these probabilities exactly.

The second and more important issue is with the sampling step in Algorithm 2. In the simpler algorithm, this step is well-defined as the sampling probabilities indeed form a valid distribution: I.e., for all vertices . However, with a general function , this sum can exceed one, rendering the sampling step in Algorithm 2 impossible. Intuitively, we can normalize the probabilities to make it a proper distribution, but by doing so, we end up losing some amount from the approximation guarantee. We hope to recover this loss using a second sampling step, as we mentioned in Section 1.2 and elaborate below.

Suppose that, instead of and (i.e., the function ), we use and to define and values. As we show later in this section, for an sufficiently small, we then have , implying that the normalization factor is at most . However, since the approximation factor of the fractional solution is only for such a solution, (i.e., ), the loss due to normalization is too significant to ignore.

Now suppose that we allow arriving vertices to sample a second edge with a small (i.e., ) probability and match that second edge if the endpoint of the first sampled edge is already matched. Consider the arrival of a fixed vertex such that , and let denote the normalized values. Further let denote the event that vertex is free (i.e, unmatched) at the arrival of . Then the probability that matches for some using either of the two sampled edges is


which is the same expression from (1) from Section 1.2, restated here for quick reference. Recall that the first term inside the parentheses accounts for the probability that matches via the first sampled edges, and the second term accounts for the probability that the same happens via the second sampled edge. Note that the second sampled edge is used only when the first one is incident to an already matched vertex and the other endpoint of the second edge is free. Hence we have the summation of conditional probabilities in the second term, where the events are conditioned on the other endpoint, , being free. If the probability given in (7) is for all , we would have the same guarantee as the fractional solution , and the rounding would be lossless. This seems unlikely, yet we can show that the quantity in (7) is at least for most (not by number, but by the total fractional value of ’s) of the edges in the graph, showing that our rounding is almost lossless. We postpone further discussion of the analysis to Section 3.4 where we highlight the main ideas before proceeding with the formal proof.

Input : A stream of vertices . At step , vertex and are revealed.
Output : A matching .
1 Let for all , let for all . Let . foreach  in the stream do
2       Update ’s and ’s using Algorithm 1 with and . foreach  do
             /* Compute as explained in Section 3.3 */
3             .
4      foreach  do
5             .
6      Pick (at most) one with probability . if  then
             With probability , pick (at most) one with probability . /* Probability of dropping edge can be computed using (7). */
7             Drop with minimal probability ensuring is matched with probability at most .
8      if a free neighbor is sampled then
9            Add to .
10      else if a free neighbor is sampled then
11            Add to .
Algorithm 3 A randomized online matching algorithm under general vertex arrivals.

Our improved algorithm is outlined in Algorithm 3. Up until Algorithm 3, it is similar to Algorithm 2 except that it uses and where we choose to be any constant small enough such that the results in the analysis hold. In Algorithm 3, if the sum of ’s exceeds one we normalize the to obtain a valid probability distribution . In Algorithm 3, we sample the first edge incident to an arriving vertex . In Algorithm 3, we sample a second edge incident to the same vertex with probability if we had to scale down ’s in Algorithm 3. Then in Algorithm 3, we drop the sampled second edge with the minimal probability to ensure that no edge is matched with probability more than . Since (7) gives the exact probability of being matched, this probability of dropping an edge can be computed by the algorithm. However, to compute this, we need the conditional probabilities , which again can be estimated using Monte Carlo sampling555It is also possible to compute them exactly if we allow the algorithm to take exponential time.. In the subsequent lines, we match to a chosen free neighbor (if any) among its chosen neighbors, prioritizing its first choice.

For the purpose of analysis we view Algorithm 3 as constructing a greedy matching on a directed acyclic graph (DAG) defined in the following two definitions.

Definition 3.7 (Non-adaptive selection graph ).

Let denote the random choices made by the vertices of . Let be the DAG defined by all the arcs , for all vertices . We call the arcs primary arcs, and the arcs the secondary arcs.

Definition 3.8 (Pruned selection graph ).

Now construct from by removing all arcs (primary or secondary) such that there exists a primary arc with arriving before . We further remove a secondary arc if there is a primary arc ; i.e., if a vertex has at least one incoming primary arc, remove all incoming primary arcs that came after the first primary arc and all secondary arcs that came after or from the same vertex as the first primary arc.

It is easy to see that the matching constructed by Algorithm 3 is a greedy matching constructed on based on order of arrival and prioritizing primary arcs. The following lemma shows that the set of matched vertices obtained by this greedy matching does not change much for any change in the random choices of a single vertex , which will prove useful later on. It can be proven rather directly by an inductive argument showing the size of the symmetric difference in matched vertices in and does not increase after each arrival besides the arrival of , whose arrival clearly increases this symmetric difference by at most two. See Appendix A for details.

Lemma 3.9.

Let and be two realizations of the random digraph where all the vertices in the two graphs make the same choices except for one vertex . Then the number of vertices that have different matched status (free/matched) in the matchings computed in and at any point of time is at most two.

3.4 Analysis

In this section, we analyze the competitive ratio of Algorithm 3. We start with an outline of the analysis where we highlight the main ideas.

3.4.1 High-Level Description of Analysis

As described in Section 3.3, the main difference compared to the simpler -competitive algorithm is the change of the construction of the fractional solution, which in turn makes the rounding more complex. In particular, we may have at the arrival of a vertex that . The majority of the analysis is therefore devoted to such “problematic” vertices since otherwise, if , the rounding is lossless due to the same reasons as described in the simpler setting of Section 3.2. We now outline the main ideas in analyzing a vertex with . Let be the event that vertex is free (i.e., unmatched) at the arrival of . Then, as described in Section 3.3, the probability that we select edge in our matching is the minimum of (because of the pruning in Algorithm 3), and

By definition, , and the expression inside the parentheses is at least (implying if


To analyze this inequality, we first use the structure of the selected function and the selection of to show that if then several structural properties hold (see creftypecap 3.10 and creftypecap 3.11 in Section 3.4.2). In particular, there are absolute constants and (both independent of ) such that

  1. ;

  2. for every ; and

  3. for every .

The first property implies that the right-hand-side of (8) is at most ; and the second property implies that has at least neighbors and that each neighbor satisfies .

For simplicity of notation, we assume further in the high-level overview that has exactly neighbors and each satisfies . Inequality (8) would then be implied by


To get an intuition why we would expect the above inequality to hold, it is instructive to consider the unconditional version: