Streaming Algorithms for Graph k-Matching with Optimal or Near-Optimal Update Time

We present streaming algorithms for the graph $k$-matching problem in both the insert-only and dynamic models. Our algorithms, with space complexity matching the best upper bounds, have optimal or near-optimal update time, significantly improving on previous results. More specifically, for the insert-only streaming model, we present a one-pass algorithm with optimal space complexity $O(k^2)$ and optimal update time $O(1)$, that with high probability computes a maximum weighted $k$-matching of a given weighted graph. The update time of our algorithm significantly improves the previous upper bound of $O(\log k)$, which was derived only for $k$-matching on unweighted graphs. For the dynamic streaming model, we present a one-pass algorithm that with high probability computes a maximum weighted $k$-matching in $O(Wk^2 \cdot \mbox{polylog}(n)$ space and with $O(\mbox{polylog}(n))$ update time, where $W$ is the number of distinct edge weights. Again the update time of our algorithm improves the previous upper bound of $O(k^2 \cdot \mbox{polylog}(n))$. This algorithm, when applied to unweighted graphs, gives a streaming algorithm on the dynamic model whose space and update time complexities are both near-optimal. Our results also imply a streaming approximation algorithm for maximum weighted $k$-matching whose space complexity matches the best known upper bound with a significantly improved update time.


Introduction
Streaming algorithms for graph matching have been studied extensively, in which most of the work has been focused on approximating a maximum matching. A graph stream S for an underlying graph G is a sequence of edge operations. In the insert-only streaming model, each operation is an edge-insertion, while in the dynamic streaming model each operation is either an edge-insertion or an edge-deletion (with a specified weight if G is weighted). The majority of the work on streaming algorithms for graph matching has been on the (simpler) insert-only model. More recently, streaming algorithms for graph k-matching term W nor the quadratic function k 2 in the space complexity of our algorithm for weighted k-matching can be improved/reduced (by more than a poly-logarithmic function). Given that our algorithms haveÕ(1) update time, this implies that our algorithms are essentially near-optimal in terms of both space and update time complexities. Chitnis et al. [7] proposed a streaming algorithm on the dynamic model for maximum matching. Under the promise that the cardinality of the maximum matching is not larger than k during the entire graph stream, their algorithm runs in spaceÕ(k 2 ) and has update timeÕ(1) for unweighted graphs. The assumption that the cardinality of the maximum matching is at most k during the entire graph stream is essential for their techniques to work since it is used to upper bound the number of vertices of degree larger than or equal to 10k by O(k), and the number of edges whose both endpoints have degree bounded by 10k by O(k 2 ). They also developed a streaming algorithm that approximates the maximum matching for unweighted graphs. These two algorithms can be combined to construct a k-matching with update timeÕ(k 2 ) and spaceÕ(k 2 ) for unweighted graphs. The algorithm for unweighted graphs can be extended to construct a maximum weighted k-matching for weighted graphs, which runs in spaceÕ(W k 2 ) with update timeÕ(k 2 ). In comparison, our algorithm keeps the space complexityÕ(W k 2 ) while has significantly improved update timeÕ (1).
A byproduct of our result is a one-pass streaming approximation algorithm that, for any ϵ > 0, w.h.p. computes a k-matching that is within a factor of 1 + ϵ from a maximum weighted k-matching in G. The algorithm runs inÕ(k 2 ϵ −1 log W ′ ) space and hasÕ(1) update time, where W ′ is the ratio of the maximum edge-weight to the minimum edge-weight in G. This result improves the update time complexity over the approximation result in [7], which has the same space complexity but has update timeÕ(k 2 ).
We observe that most work on weighted graph streams, including our current paper, assumes that the weight of an edge remains the same during the stream (see, e.g., [1,2,7,20,23]). To justify this assumption, we present an interesting lower bound result showing that, if this assumption is lifted, then the space complexity of the k-matching problem is at least linear in the size of the graph, and hence, can be much larger than the desirable space complexity for streaming algorithms.
The paper is organized as follows. Section 2 provides necessary definitions and a brief review on the related research. Improved streaming algorithms for graph k-matching in insert-only model and in dynamic model are presented and discussed in sections 3-5. Some lower bound results are give in section 6. Section 7 concludes with remarks.

Preliminaries
We refer to the following books for more detailed definitions [14,15,30]. We use "u.a.r." as an abbreviation for "uniformly at random". Computational Model and Problem Definition. In a parameterized graph streaming problem Q, we are given an instance of the form (S, k), where S is graph stream of some underlying graph G and k ∈ N, and we are asked to compute a solution for (S, k) [9]. A k-matching in a graph G is a matching of k edges in G. We study the following problems: p-Matching: Given a graph stream S of an unweighted graph G and a parameter k, compute a k-matching in G or report that no k-matching exists. p-WT-Matching: Given a graph stream S of a weighted graph G and a parameter k, compute a k-matching of maximum weight in G or report that no k-matching exists.

Near-Optimal Streaming Algorithms for Graph Matching
We will assume that V (G) = [n] − , and that the length of S is polynomial in n. We will design parameterized streaming algorithms for the above problems. Our algorithms first sample a subgraph G ′ of the underlying graph G in the stream such that w.h.p. G ′ contains a desired k-matching of G if and only if G has one. In the case where the size of G ′ is a function of k, such algorithms are referred to as kernelization streaming algorithms [7]. We note that result in [7] also computes a subgraph containing the edges of the desired matching, without computing the matching itself, as there are efficient algorithms for extracting the desired matching from that subgraph [18].
. be a stream of updates of an underlying vector x ∈ R n , where i j ∈ [n] and ∆ j ∈ R. The j-th update (i j , ∆ j ) updates the i j -th coordinate of x by setting x ij = x ij + ∆ j . Fix a parameter 0 < δ < 1. An ℓ 0 -sampler for x ̸ = 0 either fails with probability at most δ, or conditioned on not failing, for any non-zero coordinate x j of x, returns the pair (j, x j ) with probability 1 ||x||0 , where ||x|| 0 is the ℓ 0 -norm of x, which is the same as the number of non-zero coordinates of x. (We refer to [12].) ▶ Lemma 1 (Follows from Theorem 2.1 in [7]). Let 0 < δ < 1 be a parameter. There exists an ℓ 0 -sampler algorithm that, given a dynamic graph stream, either returns FAIL with probability at most δ, or returns an edge chosen u.a.r. from the edges of the stream that have been inserted and not deleted. This algorithm can be implemented using O(log 2 n · log(δ −1 )) bits of space andÕ(1) update time, where n is the number of vertices in the underlying graph.
We give a brief review on the known work that is related to our current paper. Most work on graph matching in the streaming model has focused on approximating a maximum matching (e.g., [4,5,19,21,22,24,26,31]), with the majority of the work pertaining to the (simpler) insert-only model. The most relevant to ours are [7,8,9,16], which studied parameterized streaming algorithms for the maximum matching problem.
Under the promise that the cardinality of the maximum matching at every instant of the stream is at most k, the authors of [8,9] presented a one-pass dynamic streaming algorithm that w.h.p. computes a maximum matching in an unweighted graph stream. The algorithms given in [8,9] run inÕ(k 2 ) space and the algorithm in [9] hasÕ(k 2 ) update time.
The authors of [7] considered the problem of computing maximum matchings in the dynamic streaming model. For an unweighted graph G, under the promise that the cardinality of the maximum matching at every instant of the stream is at most k, a sketch-based algorithm is presented, which w.h.p. computes a maximum matching of G, runs inÕ(k 2 ) space, and hasÕ(1) update time. They proved an Ω(k 2 ) lower bound on the space complexity of any randomized algorithm for the parameterized maximum matching problem, even in the insertonly model, thus showing that the space complexity of their algorithm is optimal (modulo a poly-logarithmic factor). The algorithm for unweighted graphs has been extended to weighted graphs: under the same promise, there is an algorithm for computing a maximum weighted matching that runs in spaceÕ(k 2 W ) and hasÕ(1) update time, where W is the number of distinct edge weights. For unweighted graphs with larger matchings, an approximation algorithm is proposed [7]. Specifically, if the graph contains matchings of size larger than k, then for any 1 ≤ α ≤ √ k and 0 < ϵ ≤ 1, there exists anÕ(k 2 α −3 ϵ −2 )-space algorithm that returns a matching of size at least (1−ϵ)k 2α . The algorithm hasÕ(k 2 α −2 ϵ −2 ) update time. Fafianie and Kratsch [16] studied kernelization streaming algorithms in the insert-only model for the NP-hard d-Set Matching problem (among others), which for d = 2, is equivalent to the k-matching problem on unweighted graphs. Their result implies a one-pass kernelization streaming algorithm for k-matching in unweighted graphs that computes a kernel of size O(k 2 log k), runs in O(k 2 ) space, and has O(log k) update time.
Chen et al. [6] studied algorithms for k-matching on the RAM model with limited computational resources, which is clearly very different from the streaming model. In order to translate their algorithm to the streaming model, it would require Ω(nk) space and multiple passes. However, we remark that one of the steps of our algorithm in the insert-only model was inspired by the constructition of reduced graphs introduced in [6].
Finally, there has been work on computing matchings in special graph classes, and with respect to parameters other than the cardinality of the matching (e.g., see [27,28]).

Algorithms in Insert-Only Streaming Model
In this section, we give a streaming algorithm for p-WT-Matching, and hence for p-Matching as a special case, in the insert-only model. We start with some notations. Given a weighted graph G = (V = [n] − , E) along with a weight function wt : E(G) → R ≥0 , and a parameter k, we define a new function β : Define a partial order relation ≺ on E(G) as follows: for any two distinct edges e, e ′ ∈ E(G), e ≺ e ′ if β(e) is lexicographically smaller than β(e ′ ). For a vertex v ∈ V and an edge e incident to v, define Γ v to be the sequence of edges incident to v, sorted in a decreasing order w.r.t. ≺. We say that e is the i-heaviest edge w.
When the function f is clear from the context, we will simply say that "M is nice." We define the compact subgraph of H under f , denoted Compact(H, f ), as the subgraph of H consisting of the edges e in H whose endpoints belong to different subsets V i and V j in V, with i ̸ = j, and such that β(e) is the maximum over all edges between V i and V j . Finally, we define the reduced compact subgraph of H under f , denoted Red-Com(H, f ), by (1) for each pair (V i , V j ) of subsets, selecting edges e ∈ Compact(H, f ) with endpoints in V i and V j such that e is among the 8k heaviest edges incident to vertices in V i and among the 8k heaviest edges incident to vertices in V j (in both subsets, if there are not that many edges, then include all edges); and then (2) retaining from the selected edges in (1) the q = k(16k − 1) heaviest edges (again if there are not that many edges, include all edges). We have the following: Proof. Define the auxiliary weighted graph Φ whose vertices are the subsets Obviously, there is one-to-one correspondence between the nice k-matchings in Compact(H, f ) and the k-matchings in Φ. Let H be the subgraph of Φ formed by selecting edges [V i , V j ] such that [V i , V j ] is among the 8k heaviest edges incident to V i and among the 8k heaviest edges incident to V j . Let H ′ consist of the q = k(16k − 1) heaviest edges in H (if H has at most q edges, let H ′ = H).
Since there is a one-to-one correspondence between the nice k-matchings in Compact(H, f ) and the k-matchings of Φ, it suffices to prove the statement of the lemma with respect to matchings in Φ and H ′ : namely, if Φ has a maximum weighted k-matching M then H ′ has a maximum weighted k-matching of the same weight as M .

Near-Optimal Streaming Algorithms for Graph Matching
Suppose that Φ has a maximum weighted k-matching M . Choose M such that the number of edges in M that remain in H is maximized. We first show that all the edges in M remain in H. Suppose not, then there is an edge Since Φ is finite, the above process must end at an edge e not in M and such that β(e) For i > 0, letî be the largest multiple of q that is smaller than i, that is, i =î + p, where 0 < p ≤ q; and let i * be the largest multiple of q that is smaller thanî ifî > 0, and 0 otherwise. The subgraph G f i is defined only when i is a multiple of q, and is defined recursively i is the reduced compact subgraph of the graph consisting of G f i plus the subgraph consisting of the edges encountered after e i * , starting from e i * +1 up to eî. The subgraph consists of the previous (before i) reduced compact subgraph plus the subgraph consisting of the edges starting after i * up to i. We refer to Figure 1 for an illustration of the definitions of G f i and G s i .
it is easy to verify that Red-Com(G i , f ) does not contain the edges in G j , for each j ≥ 1. It follows that Red-Com(G i , f ) is a subgraph of G s i , and hence, G s i contains a maximum weighted k-matching of Red-Com(G i , f ), and hence of Compact(G i , f ) by the above discussion. Since Compact(G i , f ) contains a maximum weighted k-matching of G i , G s i contains a maximum weighted k-matching of G i . It follows that, with probability at least 1/2, G s i contains a maximum weighted k-matching of G i . ◀ The algorithm A Insert , when queried at the end of the stream, either returns a maximum weighted k-matching of G or the empty set. To do so, at every instant i, it will maintain a subgraph G s i that will contain the edges of the desired matching, from which this matching can be extracted. To maintain G s i , the algorithm keeps track of the subgraphs G s i−1 , G f i , the edges e i * +1 , . . . , e i , and will use them in the computation of the subgraph G s i as follows. If i is not a multiple of q, then G s i = G s i−1 + e i , and the algorithm simply computes G s i as such.
. , e i } to compute and return G s i ; however, in this case (i.e., i is a multiple of q), the algorithm will additionally need to have G f i already computed, in preparation for the potential computations of subsequent G s j , for j ≥ i. By Lemma 3, the subgraph G f i can be computed by invoking the algorithm Alg-Reduce in Lemma 3 on G f i ∪ G i * +1,î , which runs in time O(q). Note that both G f i and G i * +1,î are available to A Insert at each of the stepsî + 1, . . . , i. Therefore, the algorithm will stagger the O(q) many operations needed for the computation of By Lemma 4, if G m , i.e., G, contains a maximum weighted k-matching, with probability at least 1/2, one copy of G s m contains a maximum weighted k-matching of G. Hence, with probability at least 1 − (1/2) ⌈log 1 δ ⌉ ≥ 1 − δ, G ′ contains a maximum weighted k-matching of G. It follows that if G contains a maximum weighted k-matching M then, with probability at least 1 − δ, G ′ contains a maximum weighted k-matching of the same weight as M and hence M ′ is a maximum weighted k-matching of G.
Observe that the graph G ′ is a subgraph of G. Therefore, statement (2) in the theorem clearly holds true. By Lemma 5, the above algorithm runs in space O(k 2 log 1 δ ) and has update time O(log 1 δ ), thus completing the proof. ◀

The Toolkit
In this section, we prove a theorem that can be useful in its own right for subset problems, that is, problems in which the goal is to compute a k-subset S (k ∈ N) of some universe U such that S satisfies certain prescribed properties. Intuitively, the theorem states that, for any k-subset S ⊆ U , w.h.p. we can compute k subsets T 1 , . . . , T k of U that interact "nicely" with S. More specifically, (1) the sets T i , for i ∈ [k], are pairwise disjoint, (2) S is contained in their union i∈[k] T i , and (3) each T i contains exactly one element of S. The above theorem will be used in Section 5 to design algorithms for p-Matching and p-WT-Matching in the dynamic streaming model. Intuitively speaking, the theorem will be invoked to obtain the sets T i of vertices that w.h.p. induce the edges of the desired k-matching; however, these sets may not necessarily constitute the desired subgraph as they may not have "small" cardinalities. Sampling techniques will be used to select a smaller set of edges induced by the vertices of the T i 's that w.h.p. contains the edges of the k-matching.
The following theorem is proved in [35], and will be used in our discussion. To prove our theorem, we proceed in two phases. We give an intuitive description of these two phases. In the first phase, we choose a hashing function f u.a.r. from an O(ln k)-wise independent set of hash functions, which hashes U to a set of d 1 = O(k/ ln k) integers. We use f to partition the universe U into d 1 -many subsets U i . Afterwards, we choose d 1 families F 0 , . . . , F d1−1 of hash functions, each containing d 2 = O(ln k) functions, chosen independently and u.a.r. from a universal set of hash functions. The family F i , i ∈ [d 1 ] − , will be used restrictively to map the elements of U i . Since each family F i is chosen from a universal set of hash function, for the subset S i = S ∩ U i , w.h.p. F i contains a hash function f i that is perfect w.r.t. S i ; that is, under the function f i the elements of S i are distinguished. This concludes the first phase of the process, which is described in Algorithm 1. In the second phase, we define a relation G (from U ) that, for each x ∈ U , associates a set G(x) of integers. This relation extends the hash functions in the F j 's above by (1) ensuring that elements in different parts of U (w.r.t. the partitioning) are distinguished, in the sense that they are associated with subsets of integers that are contained in disjoint intervals of integers; and (2) maintaining the property that elements of the same part U j that are distinguished under some function in F j remain so under the extended relation. To do so, for each part U j , we associate an "offset" and create a large gap between any two (consecutive) offsets; we will ensure that all the elements in the same U j fall within the same interval determined by two consecutive offsets. To compute the set G(x), for an element x ∈ U j , we start with an offset o j that depends solely on U j (o j = j · d 2 · d 3 in Algorithm 2), and consider every function in the family F j corresponding to U j . For each such function h i , we associate an offset o ′ i (o ′ i = (i − 1) · d 3 in Algorithm 2), and for x and that particular function h i , we add to G(x) the value g(j, i, . The above phase is described in Algorithm 2. Now that the relations G(x), for x ∈ U , have been defined, we will show in the following theorem that, for any k-subset S of U , w.h.p. there exist k distinct elements i 0 , . . . , i k−1 , such that their pre-images G −1 (i 0 ), . . . , G −1 (i k−1 ) are pairwise disjoint, contain all elements of S, and each pre-image contains exactly one element of S; those pre-images serve as the desired sets T i , for i ∈ [k].
Consider Algorithm 1 and Algorithm 2, and refer to them for the terminologies used in the subsequent discussions.
We define next two sequences of intervals, and prove certain properties about them, that will I S A A C 2 0 2 1 48:10 Near-Optimal Streaming Algorithms for Graph Matching Algorithm 2 : An algorithm that defines the relation G from U to [d1 · d2 · d3] − .

▶ Lemma 8. The following statements hold: (A) For any two distinct integers
▶ Theorem 9. For any subset S ⊆ U of cardinality k ≥ 2, with probability at least 1 − 4 Clearly, the sets U j , for j ∈ [d 1 ] − , partition the universe U . We will show that, with probability at least 1 − 4 k 3 ln k , there exist k sets T i0 , . . . , T i k−1 that satisfy conditions (1)-(3) in the statement of the theorem.
Let S ⊆ U be any subset such that |S| = k. For j ∈ [d 1 ] − and y ∈ S, let X y,j be the random variable defined as X y,j = 1 if f (⌞y⌟) = ⌞j⌟ and 0 otherwise. Let X j = y∈S X y,j , and S j = {y ∈ S | f (⌞y⌟) = ⌞j⌟}. Thus, |S j | = X j . Since f is ⌈12 ln k⌉-wise independent, the random variables X y,j , for y ∈ S, are ⌈12 ln k⌉-wise independent and Pr(X y,j = 1) = Assume that event E occurs, i.e., that |S j | ≤ 13 ln k holds for j ∈ [d 1 ] − . Consider Step 4 in Algorithm 1. Fix j ∈ [d 1 ] − , and let E j be the event that F j does not contain any perfect hash function w.r.t. S j . Let h be a hash function picked from H ′ u.a.r. Since |S j | ≤ 13 ln k (by assumption), by Theorem 11.9 in [11], with probability at least 1/2, h is perfect w.r.t. S j . Since F j consists of ⌈8 ln k⌉ hash functions chosen independently and u.a.r. from H ′ , we have Pr(E j ) ≤ (1/2) ⌈8 ln k⌉ < 1 k 4 . Applying the union bound, we have Pr that such a set {f 0 , . . . , f d1−1 } of functions exists. Let η(q) be the iteration number i in Step 5 of Algorithm 2 during which f q ∈ F q is chosen, for q ∈ [d 1 ] − . We define the following (multi-)set B as follows. For each q ∈ [d 1 ] − , and for element x ∈ S q , add to B the element g(q, η(q), x)) defined in Steps 5-6 of Algorithm 2 (by {f, f 0 , . . . , f k−1 }). Observe that, by the definition of B, for every x ∈ S, there exists a ∈ B such that x ∈ T a . We will show next that B contains exactly k distinct elements, and that, for any a ̸ = b ∈ B, it holds that T a ∩ T b = ∅. The above will show that the sets {T a | a ∈ B} satisfy conditions (1)-(3) of the theorem, thus proving the theorem.
It suffices to show that for any two distinct elements of S, the corresponding elements added to B are distinct. Let x 1 and x 2 be two distinct elements of S. Assume that x 1 ∈ S j and x 2 ∈ S l , where j, l ∈ [d 1 ] − . We distinguish two cases based on whether or not j = l.
If j = l, we have g(j, η(j), Suppose now that j ̸ = l. By definition of S j , S l , U j , U l , we have S j ⊆ U j and S l ⊆ U l . Consequently, g(j, η(j), x 1 ) ∈ G(U j ) and g(l, η(l), x 2 ) ∈ G(U l ) hold. By part (B) of Lemma 8, we have G(U j ) ⊆ I ′ j and G(U l ) ⊆ I ′ l . Therefore, g(j, η(j), x 1 ) ̸ = g(l, η(l), x 2 ). Moreover, Step 6 can be implemented in time polynomial in log k, since |F j | = ⌈8 ln k⌉. Altogether, Algorithm 2 takes time polynomial in log |U |. This completes the proof. ◀

Algorithms in Dynamic Streaming Model
In this section, we present results on p-Matching and p-WT-Matching in the dynamic streaming model. The algorithm uses the toolkit developed in the previous section, together with the ℓ 0 -sampling technique discussed in Section 2. We first give a high-level description of how the algorithm works. Let S be a graph stream of a weighted graph G = (V = [n] − , E) along with the weight function wt : E(G) −→ R ≥0 , and k be a parameter. Suppose G has W distinct weights. We will hash the vertices of the graph to a range R of size O(k log 2 k). For each element (e = [u, v], wt(e), op) ∈ S, where op is either insertion or deletion, we use the relation G, discussed in Section 4, and compute the two sets G(u) and G(v). For each i ∈ G(u) and each j ∈ G(v), we associate an instance of an ℓ 0 -sampler primitive, call it C i,j,wt (u,v) , and update it according to the operation op. Recall that it is assumed that the weight of every edge does not change throughout the stream.

48:12 Near-Optimal Streaming Algorithms for Graph Matching
The solution computed by the algorithm consists of a set of edges created by invoking each of theÕ(W k 2 ) ℓ 0 -sampler algorithms to sample at most one edge from each C i,j,w , for each pair of i, j in the range R and each edge-weight of the graph stream.
The intuition behind the above algorithm (i.e., why it achieves the desired goal) is the following. Suppose that there exists a maximum weighted k-matching M in G, and let By Theorem 9, w.h.p. there exist i 0 , . . . , i 2k−1 in the range R such that u j ∈ T ij , for j ∈ [2k] − , and such that the T ij 's are pairwise disjoint. Consider the k ℓ 0 - samplers C i2j ,i2j+1,wt(u2j ,u2j+1) , where j ∈ [k] − . Then, w.h.p., the k edges sampled from these k ℓ 0 -samplers are the edges of a maximum weighted k-matching (since the T ij 's are pairwise disjoint) whose weight equals that of M .

Algorithm 3
The streaming algorithm A dynamic in the dynamic streaming model. . Let A dynamic be the algorithm consisting of the sequence of three subroutines/algorithms A dynamic -Preprocess, A dynamic -Update, and A dynamic -Query, where A dynamic -Preprocess is applied at the beginning of the stream, A dynamic -Update is applied after each operation, and A dynamic -Query is applied whenever the algorithm is queried for a solution after some update operation. Without loss of generality, and for convenience, we will assume that the algorithm is queried at the end of the stream S, even though the query could take place after any arbitrary operation.
▶ Lemma 11. Let M ′ be the matching obtained by applying the algorithm A dynamic with A dynamic -Query invoked at the end of S. If G contains a k-matching then, with probability at least 1 − Proof. First, observe that G ′ is a subgraph of G, since it consists of edges sampled from subsets of edges in G. Therefore, statement (2) in the theorem clearly holds true. Statement (1) follows from Lemma 11. Next, we analyze the update time of algorithm A dynamic .
From Algorithm 1 and Algorithm 2, we have For the update time, it suffices to examine Steps 1-6 of A dynamic -Update By Theorem 10, Steps 1-2 take time polynomial in log n, which isÕ(1). For Step 4, we can index C using a sorted sequence of triplets (i, j, w), where i, j ∈ [d 1 · d 2 · d 3 ] − and w ranges over all possible weights. Since . Finally, consider A dynamic -Query The space in Steps 1 -4 is dominated by the space used by C and the space needed to store the graph G ′ , and hence E ′ . By the above discussion, C takes spaceÕ(W k 2 ). Since at most one edge is sampled from each ℓ 0 -sampler instance and |C| = O(W k 2 ln 4 k), we have |E ′ | = |C| =Õ(W k 2 ).
Step 5 utilizes space O(|E ′ |) [17,18]. Therefore, A dynamic -Query runs in spaceÕ(W k 2 ). It follows that the space complexity of A dynamic isÕ(W k 2 ). ◀ Using Theorem 12, and following the same approach in [7], we obtain the following: Proof. For each edge e ∈ E, round wt(e) and assign it a new weight of (1 + ϵ) i such that (1 + ϵ) i−1 < wt(e) ≤ (1 + ϵ) i . Thus, there are O(ϵ −1 log W ′ ) distinct weights after rounding. By Theorem 12, the space and update time areÕ(k 2 ϵ −1 log W ′ ) andÕ(1) respectively, and the success probability is at least 1 − 11 20k 3 ln(2k) . Now we prove that wt(M ′ ) > (1 − ϵ)wt(M ). Let e ∈ M and let e ′ be the edge sampled from the ℓ 0 -sampler that e is fed to. It suffices to prove that wt(e ′ ) > (1 − ϵ)wt(e). Assume that wt(e) is rounded to (1 + ϵ) i . Then, wt(e ′ ) is rounded to (1 + ϵ) i as well. If wt(e ′ ) ≥ wt(e), we are done; otherwise, The following theorem is a consequence of Theorem 12 (applied with W = 1): ▶ Theorem 14. There is an algorithm for p-Matching that computes a matching M ′ satisfying that (1) if G contains a k-matching then, with probability at least 1 − In this section, we discuss lower bounds on the space complexity of randomized streaming algorithms for p-Matching in the insert-only model (hence also in the dynamic model), and for p-WT-Matching in the dynamic model. These lower bound results, in conjunction with the algorithms given in the previous sections, show that the space complexity achieved by our algorithms is optimal (modulo a poly-logarithmic factor in the input size).
We will use the one-way communication model to prove lower bounds on the space complexity of randomized streaming algorithms for p-Matching and p-WT-Matching. In this model, there are two parties, Alice and Bob, each receiving x and y respectively, who wish to compute f (x, y). Alice is permitted to send Bob a single message M , which only depends on x and Alice's random coins. Then Bob outputs b, which is his guess of f (x, y).
Here, b only depends on y, M, and Bob's random coins. We say the protocol computing f with success probability 1 − δ if Pr(b = f (x, y)) ≥ 1 − δ for every x and y.
For p-Matching, we have the following theorem, which is implied from the space complexity lower-bound proof given in [7] for maximum matching.

Concluding Remarks
In this paper, we presented streaming algorithms for the fundamental k-matching problem, for both unweighted and weighted graphs, and in both the insert-only and dynamic streaming models. While matching the best space complexity of known algorithms, which has been proved to be either optimal or near-optimal, our algorithms have much faster update times.
For the insert-only model, our algorithm is optimal in both space and update time complexities. For the dynamic model, according to the new lower bounds we developed, our algorithms are near-optimal (i.e., optimal up to a poly-logarithmic factor) in both space and update time complexities. Our result for the weighted k-matching problem was achieved using a newly-developed structural result that is of independent interest. We believe that our results and techniques can have wider applicability for other fundamental graph problems. Most work on weighted graph streams, including ours, assumes that the weight of an edge is unchanged in the stream [1,2,7,20,23]. We give an interesting observation below to justify this assumption and show that, if this assumption is lifted, then the space complexity of the k-matching problem can be much larger than the desirable space complexity for streaming algorithms. This lower bound is derived by a reduction from the following problem: Given a data stream S ′ = x 1 , x 2 , . . . , x m , where x i ∈ {1, . . . , n ′ }, let c i = |{j | x j = i}| be the number of occurrences of i in the stream S ′ . Compute F ∞ = max 1≤i≤n ′ c i .
▶ Theorem 18 ([32]). For data streams of length m, any randomized streaming algorithm computing F ∞ to within a (1 ± 0.2) factor with probability 2/3 requires space Ω(min{m, n ′ }). Now we consider the p-WT-Matching problem in the more generalized dynamic streaming model, in which an instance of p-WT-Matching is given by a parameter k and a stream S = (e i1 , ∆ 1 (e i1 )), . . . , (e ij , ∆ j (e ij )), . . . of updates of edge weights in the underlying graph G, where the update (e ij , ∆ j (e ij )) changes the current weight wt(e ij ) of edge e ij to wt(e ij ) = wt(e ij ) + ∆ j (e ij ), assuming wt(·) = 0 initially and wt(·) ≥ 0 for all updates. This model generalizes the dynamic graph streaming model in [7]. ▶ Theorem 19. Under the more generalized dynamic streaming model, any randomized streaming algorithm that, with probability at least 2/3, approximates the maximum weighted 1-matching of the graph to a factor of 6/5 uses space Ω(min{m, (n−1)(n−2) 2 }).