Matchings under distance constraints II

This paper introduces the \emph{$d$-distance $b$-matching problem}, in which we are given a bipartite graph $G=(S,T;E)$ with $S=\{s_1,\dots,s_n\}$, a weight function on the edges, an integer $d\in\mathbb{Z}_+$ and a degree bound function $b:S\cup T\to\mathbb{Z}_+$. The goal is to find a maximum-weight subset $M\subseteq E$ of the edges satisfying the following two conditions: 1) the degree of each node $v\in S\cup T$ is at most $b(v)$ in $M$, 2) if $s_it,s_jt\in M$, then $|i-j|\geq d$. In the cyclic version of the problem, the nodes in $S$ are considered to be in cyclic order. We get back the \emph{(cyclic) $d$-distance matching problem} when $b(s) = 1$ for $s\in S$ and $b(t) = \infty$ for $t\in T$. We prove that the $d$-distance matching problem is APX-hard even in the unweighted case. We show that $(2-\frac{1}{d})$ is a tight upper bound on the integrality gap of the natural integer programming model for the cyclic $d$-distance $b$-matching problem provided that $(2d-1)$ divides the size of $S$. For the non-cyclic case, the integrality gap is shown to be at most $(2-\frac{2}{d})$. The proofs give approximation algorithms with guarantees matching these bounds, and also improve the best known algorithms for the (cyclic) $d$-distance matching problem. In a related problem, our goal is to find a permutation of $S$ maximizing the weight of the optimal $d$-distance $b$-matching. This problem can be solved in polynomial time for the (cyclic) $d$-distance matching problem -- even though the (cyclic) $d$-distance matching problem itself is NP-hard and also hard to approximate arbitrarily. For (cyclic) $d$-distance $b$-matchings, however, we prove that finding the best permutation is NP-hard even if $b\equiv 2$ or $d=2$, and we give $e$-approximation algorithms.


Introduction
In this paper, we introduce a natural generalization of the d-distance matching problem [13], where the degree upper bound function in S can be other than the all-one function, and degree bounds can be posed on the nodes in T as well.Given a bipartite graph G = (S, T ; E) with S = {s 1 , . . ., s n }, a positive integer d ∈ N and a function b : S ∪ T → Z + , an edge set M ⊆ E is called d-distance b-matching if 1) the degree of each node v ∈ S ∪ T is at most b(v) in M and 2) if s i t, s j t ∈ M for i = j, then |i − j| ≥ d.A d-distance b-matching is called perfect if the degree of each node s ∈ S is exactly b(s).In the cyclic version of the problem, the nodes in S are considered to be in a cyclic order, and 2) is required cyclically, that is, if s i t, s j t ∈ M for i = j, then both |i − j| ≥ d and |i − j| ≤ n − d must hold.
In the (cyclic) d-distance b-matching problem, the goal is to find a maximumweight (cyclic) d-distance b-matching for a given weight function w : E → R. The special case w ≡ 1 is referred to as the unweighted problem.Note that the special case when b(v) = 1 if v ∈ S and ∞ if v ∈ T is the d-distance matching problem, which was introduced in an earlier article from the same author [13].
The (perfect) d-distance b-matching problem is not only a natural problem extending the literature of matchings, but it also appears in several applications, which are natural extensions of the situations in which the d-distance matching problem could be applied, see [13].For example, imagine n consecutive all-day events s 1 , . . ., s n , each of which must be assigned b(s i ) of watchmen t 1 , . . ., t k .For each event s i , a set of possible watchmen is given -those who are qualified to be on guard at event s i .Appoint exactly b(s i ) watchmen to event s i such that no watchman is assigned to more than one of any d consecutive events, where d ∈ N is given, and each watchman t j is on guard at most b(t j ) events.In the weighted version of the problem, let w s i t j denote the level of safety of event s i if watchman t j is on watch, and the objective is to maximize the level of overall safety.
As another application of the above question, consider n items s 1 , . . ., s n one after another on a conveyor belt, and k machines t 1 , . . ., t k .Each item s i is to be processed on the conveyor belt by b(s i ) of the qualified machines N (s i ) ⊆ {t 1 , . . ., t n } such that if a machine processes item s i , then it cannot process any of the next (d − 1) items -because the conveyor belt is running.

Previous work
In the special case d = |S|, one gets the classic b-matching problem in bipartite graphs.For d = 1, the problem reduces to the b-matching problem in bipartite graphs, and we will see that it is a special case of the circulation problem for d = 2.
A feasible d-distance b-matching M can be thought of as a b-matching that does not contain the edge set {s i t, s j t} for any t ∈ T and |i − j| ≤ d.A similar problem is the K p,p -free p-matching problem [15].Here one is given an arbitrary family T of the subgraphs of G isomorphic with K p,p , and the goal is to find a maximum-cardinality b-matching which does not induce any subgraph in T , where b : S ∪ T → {0, . . ., p}.This problem can be solved in polynomial time.Note that in the d-distance b-matching problem, b is arbitrary and the type of the forbidden subgraphs is K 2,1 .Another similar problem is the following.Given a partition E 1 , . . ., E k of E and positive integers r 1 , . . ., r k , find a perfect matching M for which |M ∩ E i | ≤ r i .The problem is introduced and shown to be NP-complete in [9].Note that the side constraints in the distance matching problem are similar, but the degree constraints are different and our edge sets do not form a partition of E. Several other versions of the "restricted" (b-)matching problem have been introduced, for example in [2,4,7,16].
The perfect d-distance matching problem is a special case of the list-coloring problem on interval graphs [18] and also of the frequency assignment problem [1], as it was shown in [13].
The d-distance matching problem was shown to be NP-hard and an FPT algorithm parameterized by d was given in [13].An efficient algorithm was also described for the case when the size of T is a constant.A (2 − 1 2d−1 )-approximation algorithm for the weighted d-distance matching problem was given, which also implies that the integrality gap of the natural IP model is at most this value.We also gave a (3/2 + ǫ)-approximation algorithm for any constant ǫ > 0 in the unweighted case.

Our results
We investigate the integrality gap of the natural IP model and give approximation algorithms for the (cyclic) d-distance b-matching problem in Section 2. In particular, we show that (2 − 1 d ) is a tight upper bound on the integrality gap in the cyclic case provided that (2d − 1) divides the size of S. Concerning the non-cyclic case, the integrality gap is shown to be at most (2 − 2 d ) for d ≥ 2. In addition, the proofs provide approximation algorithms with approximation factors matching the bounds above, further improving the algorithms for the (cyclic) ddistance matching problem given in an earlier article [13].As a special case, this further improves the bound on the integrality gap and the approximation factor for the d-distance matching problem from (2 Answering an open question from [13], Section 3 proves that the (cyclic) ddistance matching problem is APX-hard, even in the unweighted case.
In Section 4, motivated by the second application mentioned above, a different aspect of the problem is considered, in which our goal is to find a permutation of S maximizing the weight of the optimal d-distance b-matching.We prove that a permutation of S maximizing the weight of the optimal d-distance matching can be found in polynomial time -even though the (cyclic) d-distance matching problem itself is NP-hard and also hard to approximate arbitrarily.For (cyclic) d-distance b-matchings, however, we prove that finding the best permutation is NP-hard, even when b(s) = 2 for all s ∈ S or d = 2, and we give e-approximation algorithms for both the cyclic and the non-cyclic cases.
Notation Throughout the paper, assume that G = (S, T ; E) is a bipartite graph without loops or parallel edges, unless stated otherwise.Let ∆(v) and N (v) denote the set of edges incident to node v and the neighbors of v, respectively.For a subset X ⊆ E of the edges, N X (v) denotes the neighbors of v for edge set X. We use deg(v) to denote the degree of node v. Let L d (s i ) and R d (s i ) denote the nodes in the interval of length (at most) d ending and starting at s i , respectively, that is, , where the indices are taken modulo |S|.By definition, the minimum and the maximum of the empty set are ∞ and −∞, respectively.Given a function f : A → B, both f (a) and f a denote the value f assigns to a ∈ A, and let f (X) = a∈X f (a) for X ⊆ A. Let χ Z denote the characteristic vector of set Z, that is, χ Z (y) = 1 if y ∈ Z, and 0 otherwise.Occasionally, the braces around sets consisting of a single element are omitted, for example χ e = χ {e} for e ∈ E. Let N and Z + denote the set of positive and non-negative integers, respectively.

Integrality gap and approximation algorithms
In this section, we prove that ( 2 The LP model for the cyclic case consists of the same conditions but (1c) is required for all t ∈ T and for all i ∈ {1, . . ., n}.This model will be denoted by (LP1').When b(s) = 1 for all s ∈ S and b(t) = ∞ for all t ∈ T , the integer solutions to (LP1) correspond to the feasible d-distance matchings, and we get back the linear program investigated in [13].
The following theorem gives an upper bound on the integrality gap for the cyclic d-distance b-matching problem.
Theorem 1 If (2d − 1) divides |S|, then the integrality gap of (LP1') for the weighted cyclic d-distance b-matching problem is at most (2 − 1 d ), and this bound is tight.Furthermore, there exists a polynomial-time approximation algorithm with the same guarantee.
Proof For every i ∈ {1, . . ., 2d − 1}, let S i ⊆ S denote the union of the sets R d (s i+q(2d−1) ) for q ∈ {0, . . ., n 2d−1 − 1}.Since the size of S is divisible by (2d − 1), the nodes in S i form intervals of length d in s 1 , . . ., s n and each of these intervals is followed by (d − 1) nodes of S \ S i cyclically.For each i ∈ {1, . . ., 2d − 1}, let G i = (S, T ; E i ) be the subgraph of G on the node set of G whose edge set E i consists of the edges induced by S i and T .
First, we prove that the polytope given by (LP1') for G i is the convex hull of its integer solutions.Observe that constraints (1c) need to be required only for those intervals that are fully included in S i , because these immediately imply that the constraints hold for the rest of the intervals.The matrix of this reduced linear program is the transpose of the incidence matrices of two laminar families written under each other, which is a well-known network matrix, and the right-hand side is integer, hence the polytope is integer [6,Page 152].
Next, we prove the bound on the integrality gap.Let M i denote a maximumweight cyclic d-distance b-matching in G i , and let M be a maximum-weight solution among M 1 , . . ., M 2d−1 .Let x ∈ R E + be an optimal LP solution for G and let M * be a maximum-weight d-distance b-matching.It is easy to see that all edges of G appear in exactly d of the graphs G 1 , . . ., G 2d−1 , which means that holds.Restricting an optimal LP solution for G to the edge set of G i , a feasible LP solution is obtained for G i , so the objective value of this restricted solution can be bounded from above by the LP optimum for G i , which is equal to the IP optimum w(M i ).From these, one gets that since M is a feasible integer solution for G.This means that the integrality gap is at most (2 − 1 d ), which was to be proven.Next, we give a tight example for every d ∈ N. Let G = (S, T ; E) be a complete bipartite graph, where S = {s 1 , . . ., s 2d−1 } and T = {t}.Let b(s) = 1 for all s ∈ S, and let b(t) = ∞.For w ≡ 1, the IP optimum is 1, and x ≡ 1 d is an optimal LP solution, meaning that the LP optimum is (2 − 1 d ), hence the bound above is tight.In fact, this proof shows that M is a (2 − 1 d )-approximate solution, which can be found in polynomial time by solving (LP1') [17] for every graph G i , therefore we also obtain an approximation algorithm for those instances of the maximumweight cyclic d-distance b-matching problem in which (2d − 1)|n, which completes the proof.

⊓ ⊔
The next theorem improves this upper bound in the non-cyclic case when b(t) = ∞ for all t ∈ T .As a special case, this also improves the best known upper bound on the integrality gap for the non-cyclic d-distance matching problem from (2 − 1 2d−1 ) [13] to (2 − 2 d ).
Theorem 2 Let b : S ∪T → Z + be such that b(t) = ∞ for all t ∈ T , and let d ≥ 2.
The integrality gap of (LP1) for the weighted d-distance b-matching problem is at most (2− 2 d ).Furthermore, there exists a polynomial-time approximation algorithm with the same guarantee.
Proof Let G = (S, T ; E) be a bipartite graph, where S = {s 1 , . . ., s n }, and let d ∈ N and w : E → R + .If (2d − 2) ∤ n, then add (2d − 2 − r) new isolated nodes to the end of S, where r is such that 0 < r < 2d − 2 and n = k(2d − 2) + r for some k ∈ Z + .This leaves the feasible d-distance b-matchings in G unchanged, therefore one can assume without loss of generality that (2d − 2)|n.
We proceed similarly to the first part of the proof of Theorem 1, but now we leave out only (d − 2) consecutive nodes -instead of (d − 1) -between disjoint intervals of length d of S. That is, let S i ⊆ S denote the union of the sets R d (s i+q(2d−2) ) for q ∈ {0, . .Let the columns corresponding to the edges incident to t j form an interval for all j ∈ {1, . . ., k}, which appear in the order given by t 1 , . . ., t k , and for each t j , sort the interval of the edges incident to t j by the index of their endpoint in S. Assume that the rows corresponding to constraints (1c) appear first, in lexicographical order, and then the rows corresponding to constraints (1b) follow, also in lexicographical order.Let L denote the matrix obtained this way, and let B t denote the submatrix of L given by the edges incident to t and by the constraints (1c) for t.By construction, , where the zero entries are omitted, and each row contains either two or d one entries.The lines correspond to constraints (1c) alternately for an interval of S i and for the interval containing the last and the first node of two consecutive intervals in S i .For every t ∈ T , there is one such block B t in L placed diagonally.Furthermore, the rows corresponding to constraints (1b) give k identity matrices side by side, one under each B t , that is, L looks as follows.
Now, we prove that L is a network matrix.Note that each column of L contains either two or three ones.First, consider the submatrix L ′ formed by the columns of L containing exactly three ones -we will handle the rest of the columns later.
Deleting the full-zero rows from the matrix L ′ , which were created by deleting some of the columns from L, we get that , where for each t ∈ T .We prove that L ′ is a network matrix.Denote the size of the identity matrices in the last rows of L ′ by m.Then each block A t consists of (m + 1) rows and m columns.Let M ′ denote the submatrix given by the last m rows of L ′ , that is, the identity matrices.Let the tree F be a path P with m (undirected) edges f 1 , . . ., f m , which will correspond to the rows of M ′ .The orientation of these edges will be given later.For each node of the path P , add k new leaves connected to that node.Let e i 1 , . . ., e i k denote those newly added leaf edges which are incident to the i th node of P for i ∈ {1, . . ., m+1}.Let edge e i j correspond to the ((m+1)(j −1)+i) th row of L ′ , in other words, e i j belongs to the row containing the i th row of A t j .Orient the edges of P alternately along the path -the first edge can be oriented arbitrarily, and this determines the direction of the other edges along the path.If the (at most) two arcs of P adjacent to arc e j i are oriented towards e j i , then we orient e j i outwards from the common node.Otherwise, if the (at most) two arcs of P are oriented away from e j i , then e j i is oriented inwards -since the arcs of P are alternately oriented, only these two cases are possible.Now, we define the non-tree arcs, which correspond to the columns of the matrix.Each column intersects exactly one of the matrices in the diagonal, say A t j , and each column contains exactly three non-zero elements.Suppose that the r th column is the i th column of A t j for some j ∈ {1, . . ., k}.Then two of the three ones in the column are in the i th and (i + 1) st rows of A t j , to which rows the corresponding arcs are e i j and e i+1 j , respectively.The third one is in the j th identity matrix, in the row corresponding to arc f i .In the tree F , arcs e i j , f i and e i+1 j form a directed path, hence one can add a non-tree arc from the target of this path to its source, which corresponds to the r th column.This shows that L ′ is a network matrix.
Next, we prove that the original L is also a network matrix by a simple extension of the tree F and the non-tree arcs defined above.Let M denote the submatrix of the last Observe that if there is exactly one non-zero element in the r th column of B t j in L for some j, then there is exactly one non-zero element in the r th column of every block B t j ′ for j ′ ∈ {1, . . ., k}.Each of these columns in L contains exactly two ones.The first one is in the i th row of the corresponding block B t j , which is associated with arc e i j ∈ F .The other one is in the r th row of M .For each j ∈ {1, . . ., k}, add a new leaf to F connected to the endpoint of e i j belonging to P , and associate it with the r th row of M .Orient it such that it forms a directed path of length two with e i j .Finally, add a non-tree arc from the source of this path to its target, which corresponds to the column of L containing the r th column of B t j .This shows that L is indeed a network matrix.As the right-hand side of (LP1) is integer, we get that the polytope defined by (LP1) is integer for G i , which completes the proof of the lemma.

⊓ ⊔
We continue the proof of Theorem 2. Let x ∈ R E + be an optimal LP solution, and let x (i) ∈ R E + be an optimal LP solution for G i , where i ∈ {1, . . ., 2d − 2}.Let M * be a maximum-weight d-distance b-matching, and let M i be a maximum-weight d-distance b-matching in G i , where i ∈ {1, . . ., 2d − 2}.Chose a maximum-weight solution among M 1 , . . ., M 2d−2 , and denote it by M .
Similarly to (2), as each edge of G is contained in exactly d of the graphs G 1 , . . ., G 2d−2 , and by Claim 1, we get that which means that the integrality gap is at most (2 − 2 d ).The proof also shows that the edge set M is a (2− 2 d )-approximate solution, which can be found in polynomial time, so the proof also gives an approximation algorithm for the maximum-weight d-distance b-matching problem with the same guarantee, provided that b(t) = ∞ for all t ∈ T .
Remark 1 In the proofs of Theorems 1 and 2, we constructed a collection of edge sets such that the linear program becomes integer when the problem is restricted to any of them, and every edge is contained in d of the selected edge sets.This means that these two collections of edge sets form so-called (m, ℓ)-covers for (m, ℓ) = (2d − 1, d) and (m, ℓ) = (2d − 2, d), respectively, which gives an alternative way to finish the proofs, because the existence of an (m, ℓ)-cover implies that the integrality gap is at most m ℓ [14].Remark 2 The local search algorithm given for the unweighted d-distance matching problem [13] also works for the unweighted d-distance b-matching problem.Therefore, we have a (3/2 + ε)-approximation algorithm for the latter problem.

Hardness of approximation
In the double matching problem, we are given a bipartite graph G = (S, T ; E) and two sets S 1 , S 2 ⊆ S such that S 1 ∪ S 2 = S.The goal is to find a maximum weight (size) subset M of the edges for which both M ∩ E 1 and M ∩ E 2 are matchings, where E i denotes the edges induced by S i and T for i ∈ {1, 2}.The double matching problem is known to be APX-hard in the weighted case [14].This implies that the weighted d-distance matching problem and the unweighted cyclic distance matching problems are APX-hard by a weight-preserving reduction from the double matching problem [13].
In what follows, we prove that the hardness of approximation also applies to the unweighted non-cyclic case.
The corresponding instance of the double matching problem.Theorem 3 The unweighted double matching problem is NP-hard to α-approximate for any α < 950 949 .
Proof Given are three finite disjoint sets X, Y, Z and a set of hyperedges Finding a maximum-size 3-dimensional matching F ⊆ E cannot be approximated arbitrarily unless P=NP [10].In fact, the problem remains NP-hard to approximate better than 95 94 even for 2-regular instances, that is, when each element of X ∪ Y ∪ Z occurs in exactly two triples in E [5].To reduce the 2-regular 3-dimensional matching problem to the double matching problem, consider the following construction.
Let H X , H Y and H Z denote three copies of the set of hyperedges H, where the three versions of a hyperedge e ∈ H are e (X) ∈ H X , e (Y ) ∈ H Y and e (Z) ∈ H Z .Define a bipartite graph G = (S, T ; E), where S = H X ∪ Y ∪ H Z , T = X ∪ H Y ∪ Z and E is as follows.For each e ∈ H, add edges e (X) e (Y ) and e (Y ) e (Z) ∈ E, furthermore, add an edge to G between u and the two hyperedges in H U incident to u in H for each u ∈ U , where U ∈ {X, Y, Z}.Let S 1 = H X ∪Y and S 2 = Y ∪H Z .For a hyperedge e = (x, y, z) ∈ H, let K e = {e (X) e (Y ) , e (Z) e (Y ) , xe (X) , ye (Y ) , ze (Z) } ⊆ E. Figures 1a and 1b give an example for the construction.
Assume that there exists an α-approximation algorithm for the maximum double matching problem and let M be an α-approximate solution in G.We prove that one can construct a ( 1 10/α−9 )-approximate 3-dimensional matching in polynomial time using M , provided that α < 10  9 .First, consider the following transformation of M .For each e ∈ H, if |K e ∩M | < 3, then add edges e (X) e (Y ) and e (Y ) e (Z) to M , and remove all other edges of K e .After these operations, M remains feasible and its size does not decrease, hence it remains an α-approximate double matching.Observe that after the transformation we have either |K e ∩ M | = 2 and hence K e ∩ M = {e (X) e (Y ) , e (Y ) e (Z) }, or |K e ∩ M | = 3 and hence K e ∩ M = {xe (X) , ye (Y ) , ze (Z) } for each e = (x, y, z) ∈ H.
Construct the 3-dimensional matching F ⊆ H as the set of those hyperedges for which 2 } can hold simultaneously only if x 1 = x 2 , y 1 = y 2 and z 1 = z 2 -as the degrees of these nodes are at most one in M .
That is, we can construct a 3-dimensional matching F in H such that since exactly three edges belong to each hyperedge in F , and two edges belong to each hyperedge in H \ F .Applying this for a maximum double matching M * , we get that where F ′ denotes the 3-dimensional matching constructed from M * , and F * is a maximum 3-dimensional matching in H. Similarly, for any 3-dimensional matching Hence, for the α-approximate double matching M , the 3-dimensional matching F constructed from M , and for optimal M * and F * solutions, holds.
With the greedy method, we can always construct a 3-dimensional matching of size at least |H|  4 , therefore Using that |S| = 2|H| + |Z| = 5|Z| and that in a double matching M each s ∈ S has degree at most 1, one gets that holds.It follows from these observations that where the first inequality follows from (3), and the second one holds by (4).If α < 10  9 and , so if we had an α-approximate algorithm for the double matching problem, then we could construct a ( 1 10/α−9 )-approximate 3-dimensional matching in polynomial time.The 2-regular 3-dimensional matching problem is NP-hard to β-approximate for any β < 95 94 , which implies that the double matching problem is NP-hard to α-approximate for α < 950 949 .

⊓ ⊔
By the size-preserving reduction from the double matching problem to the distance matching problem given in [14], the previous theorem implies the following.

Theorem 4
The unweighted distance matching problem is NP-hard to α-approximate for any α < 950 949 .Clearly, this result also applies to the more general unweighted cyclic version of the problem.Note that the proof given in [14] gives a slightly larger threshold of 760  759 in the weighted non-cyclic and in the unweighted cyclic cases.

Optimal permutations
This section investigates a slightly different problem, which is motivated by the second application presented in the introduction.It is a natural question whether we can find a permutation of S -which corresponds to the items on the conveyor belt -maximizing the weight of the optimal d-distance b-matchings.Formally, let M * π denote an optimal d-distance b-matching under the permutation π of S. We want to find a permutation of S and a d-distance b-matching M * with respect to this permutation such that w(M * ) = max π∈S w(M * π ), where S is the set of all permutations of S.
In the next section, a polynomial-time algorithm is described for finding an optimal permutation and an optimal d-distance matching under this permutation (that is, when b(s) = 1 for all s ∈ S and b(t) = ∞ for all t ∈ T ).Section 4.1, however, proves that the analogous problem is NP-hard for d-distance b-matchings even if b ≡ 2 or d = 2, and gives e-approximation algorithms for general b in both the cyclic and the non-cyclic cases, where e is Euler's number.
As we have already seen, for a given permutation of S, it is NP-complete to decide whether a perfect (cyclic) d-distance matching exists; and finding a largest one is APX-hard.In this light, it is quite surprising that we can find a permutation of S which maximizes the weight of the maximum-weight (cyclic) ddistance matching -furthermore, an optimal distance matching under the optimal permutation can be found as well.
Before entering the details of this method, we need the following lemma, which is easy to prove by a straightforward reduction to the circulation problem.
Lemma 1 For a bipartite graph G = (S, T ; E), a weight function w : E → R + on its edges and integers k, r ∈ Z + , we can find a maximum-weight subset of the edges in polynomial time satisfying the following three conditions: 1) the degrees of the nodes in S are at most 1, 2) the degrees of the nodes in T are at most (k + 1), and 3) there are at most r nodes in T with degree exactly (k + 1).
Next, we prove that one can find a permutation maximizing the size of the optimal d-distance matching.Note that the first algorithm for the non-cyclic case appeared in [12].In the rest of this section, a revised, more intuitive approach is presented, which will be modified to handle the cyclic case as well.
Theorem 5 For a bipartite graph G = (S, T ; E), a weight function w : E → R + on its edges and a positive integer d ∈ N, we can find a permutation of S along with a d-distance matching M in polynomial time such that the weight of M is the largest among all d-distance matchings over all permutations of S.  Proof Let k, r ∈ Z + be such that |S| = kd + r, where 0 ≤ r < d.Find a maximumweight edge set M in G such that the degrees of the nodes in S are at most 1, the degrees of the nodes in T are at most (k + 1), and there are at most r nodes in T with degree exactly (k + 1).Such an edge set M can be found in polynomial time by Lemma 1.
Clearly, a maximum-weight d-distance matchings under all permutations fulfill these three conditions, so for this largest possible weight W , holds.To show equality, it suffices to construct a permutation of S such that M is a feasible d-distance matching in G. Let t 1 , . . ., t |T | be a permutation of the nodes in T which lists the nodes of degree (k+1) first, then the nodes with degree smaller than k, and finally the nodes of degree k.Let s ′ 1 , . . ., s ′ n be a permutation of S in which the neighbors in M of t j form an interval for all j ∈ {1, . . ., |T |} and these intervals appear in the order given by t 1 , . . ., t |T | (the order of the neighbors of any t j is arbitrary).Figure 2a shows an example for the construction.Now, take a table of size d × (k + 1), and remove all cells from the last column except for the first r.Fill the remaining cells of the table in row-major order with s ′ 1 , . . ., s ′ n .Let s 1 . . ., s n be the permutation of S obtained by reading the table in column-major order.Figure 2b shows an example for the table-filling step.
We claim that M is a feasible d-distance matching under the permutation s 1 , . . ., s n .The degrees in M of the nodes in S are clearly at most 1.To see that the distance constraints are met at each node t ∈ T , consider the following three cases.1) The degree of t in M is (k + 1).This means that the neighbors of t occupy one of the first r rows of the table, which are of length (k + 1).In column-major order, there are (d − 1) other nodes between any two consecutive neighbors of t, which was to be shown.2) The degree of t in M is smaller than k.The neighbors of t are placed to at most two rows of the table in a row-major manner.Each of these rows is of length k or (k + 1), therefore any two consecutive neighbors in row-major manner have at least (d − 1) other nodes between them.The first and the last neighbors of t have a column between them which contains no neighbors of t, and hence there are more than (d − 1) nodes between them in column-major order.3) The degree of t in M is k.By construction, the neighbors of t either occupy one of the last (d − r) rows of the table -which are of length k -, or they are placed to at most two rows in row-major manner such that the upper row is of length (k + 1).Similarly to the previous case, there are (d − 1) other nodes between any two consecutive neighbors and also between the first and the last one.These three cases prove that M is feasible under the permutation s 1 , . . ., s n of S. By (5), this means that M is a heaviest d-distance matching among all distance matchings under all permutations, which completes the proof of the theorem.⊓ ⊔ Now we prove the analogous theorem for the cyclic case.
Theorem 6 For a bipartite graph G = (S, T ; E), a weight function w : E → R + on its edges and a positive integer d ∈ N, we can find a permutation of S and a maximum-weight cyclic d-distance matching M with respect to this permutation in polynomial time such that the weight of M is the largest over all permutations of S.
Proof We follow the same principle as in the proof of Theorem 5. Let |S| = kd + r, where 0 ≤ r < d.Find a maximum-weight edge set M in G such that the degrees of the nodes in S are at most 1, and the degrees of the nodes in T are at most k.Such an edge set can be found in polynomial time.Similarly to the proof of Theorem 5, it suffices to construct a permutation of S such that M is a feasible d-distance matching in G.
Let t 1 , . . ., t |T | be a permutation of the nodes in T which lists the nodes of degree k first, then the rest of the nodes.Let s ′ 1 , . . ., s ′ n be a permutation of S in which the neighbors in M of t j form an interval for all j ∈ {1, . . ., k} and these intervals appear in the order given by t 1 , . . ., t |T | (the order of the neighbors of any t j is arbitrary).Now, take a table of size (d + 1) × k, and remove all cells from the last row except for the first r.Fill the remaining cells of the table in row-major order with s ′ 1 , . . ., s ′ n .Let s 1 . . ., s n be the permutation of S obtained by reading the table in column-major order.Similarly to the proof for the non-cyclic case, one can prove that M is a feasible d-distance matching under this permutation.

⊓ ⊔
Observe that Theorems 5 and 6 extend to the case when degree bounds are also given for the nodes in T .To prove this, one can require that in the initial edge set M , found in the first steps of the proofs, the degree of each node t ∈ T is also at most b(t) -Lemma 1 is easy to modify for finding such an edge set.

(Cyclic) d-distance b-matchings
This section proves that the analogous problem for d-distance b-matchings is hard, even if b ≡ 2 or d = 2.

Hardness results
We saw that an optimal permutation can be found in polynomial time for both cyclic and non-cyclic d-distance matchings.This section investigates the complexity of the analogous problem for the d-distance b-matching problem.First, we show that finding an optimal permutation is already hard when b(s) = 2 for all s ∈ S and b(t) = ∞ for all t ∈ T , that is, we consider the slight modification of the d-distance matching problem where the degree bound for each node in S is twoinstead of the all-one bound.
Theorem 7 It is NP-complete to decide whether there exists a permutation of S such that there is a perfect d-distance b ′ -matching under this permutation, where given and the goal is to decide whether it contains a 2-factor (that is, a subgraph in which the degree of each node is exactly two) such that the length of every cycle in it is a multiple of 4. This problem is known to be NP-complete [3], therefore, it suffices to reduce it to the problem defined in the theorem.Without loss of generality, we can assume that |S ′ | = |T ′ | -otherwise, the instance of the C 4k+2 Free2Factor problem is not solvable.Let G = (S, T ; E) be a copy of G ′ , and add |S ′ | new nodes to S, and 2|S| new nodes to |T |.Add |S ′ | node-disjoint paths of length two on the newly added nodes such that the nodes in the middle of the paths are in S and their endpoints are in T .We show that G ′ has a 2-factor consisting of cycles whose length is divisible by 4 if and only if there is a permutation of S such that a perfect d-distance b ′ -matching exists in G, where b ′ is as defined in ( 6) and d = |S|/2.
Let s 1 , . . ., s n be a permutation of the nodes in S such that there exists a perfect d-distance b ′ -matching M ⊆ E. The degrees in M of the nodes in S are exactly 2, so M contains all the edges of the paths of length 2 added to G, and the degrees of the nodes in T ′ ⊆ T are also exactly 2 since |S ′ | = |T ′ |.Therefore, restricting M to the edge set of the original graph G ′ , we get a 2-factor in G ′ .We prove that the length of each cycle is a multiple of 4. For all t ∈ T , if s i t, s j t ∈ M for some i = j and hence t ∈ T ′ , then |i − j| ≥ |S ′ |.But |S| = 2|S ′ |, thus one of the indices i and j is in {1, . . ., |S|}, and the other one is in {|S ′ | + 1, . . ., 2|S ′ |}.This means that the nodes of S can be divided into two disjoint sets S 1 and S 2 such that one of the neighbors of t is in S 1 and the other one is in S 2 for all t ∈ T ′ .From this, one gets that every second node of any cycle in M ′ is in S, and the nodes of the cycle in S are alternately in S 1 and in S 2 , so the length of every cycle must be a multiple of 4.
To finish the proof, we show that if there is a 2-factor in G ′ with cycles whose length is divisible by 4, then there exists a permutation of the nodes in S such that there is a d-distance b ′ -matching in G.For each cycle of the 2-factor, divide its nodes belonging to S into two sets S 1 and S 2 alternately.Construct a permutation by enumerating the nodes of S 1 in arbitrary order, then the middle nodes of the paths of length two in arbitrary order, and finally the nodes of S 2 in arbitrary order.Under this permutation, the union of the edge set of the 2-factor and the edges of the paths of length two form a d-distance b ′ -matching, where b ′ is as defined in (6) and To prove a similar theorem for the cyclic case, we need the following lemma.

Lemma 2 It is NP-complete to decide whether all nodes of a bipartite graph G = (S, T ; E) can be covered by node-disjoint cycles of length 4.
Proof Given four disjoint sets X 1 , X 2 , X 3 , X 4 and a set of hyperedges It is NP-complete to decide whether there exists a 4-dimensional matching of size |X 1 | [11].
We reduce the 4-dimensional matching problem to the problem defined in the lemma statement.Let H = (X 1 ∪ X 2 ∪ X 3 ∪ X 4 , E) denote the hypergraph given in the 4-dimensional matching problem, and define an instance of the problem given in the statement of the lemma as follows.Let the node set of G consist of the elements in X 1 ∪ X 2 ∪ X 3 ∪ X 4 and, for each e ∈ E, four additional nodes v e 1 , v e 2 , v e 3 and v e 4 .For each hyperedge (v 4 to G for all e ∈ E. Figure 3 illustrates the construction for the hyperedge (v 1 , v 2 , v 3 , v 4 ) ∈ E. It is easy to see that G is bipartite: let S consist of the nodes in X 2 ∪ X 4 and also the nodes v e for v ∈ X 1 ∪ X 3 , e ∈ E, and let T consist of the rest of the nodes.By the definition of E, neither of the two parts induces any edges.We need to show that there is a perfect 4-dimensional matching in H if and only if G has a vertex cover with node-disjoint 4-cycles.
Firstly, given a perfect 4-dimensional matching F in H, we construct the set of 4-cycles as follows.For any hyperedge e = (v 1 , v 2 , v 3 , v 4 ) ∈ F , select the cycle formed by the nodes v 1 , v e 1 , v e 2 , v 2 and the cycle on nodes v 3 , v e 3 , v e 4 , v 4 .For each hyperedge (u 1 , u 2 , u 3 , u 4 ) ∈ E \ F , also add the cycle formed by the nodes u e 1 , u e 2 , u e 3 , u e 4 .The 4-cycles obtained this way are pairwise node-disjoint, because the hyperedges in F form a 4-dimensional matching.Clearly, they cover all the nodes of G, because F is a perfect 4-dimensional matching.
Secondly, assume that there exists a cover with node-disjoint 4-cycles in G.We modify the set of the cycles as follows.If for a hyperedge e = (v 1 , v 2 , v 3 , v 4 ) both of the cycles formed by nodes v 1 , v Proof Clearly, the problem is in NP.We reduce the problem defined in Lemma 2 to the problem in the theorem.Let G = (S, T ; E) be a bipartite graph, and let d = |S|/2.Assume that |S| = |T |.We show that the nodes of G can be covered by node-disjoint cycles of length 4 if and only if there exists a permutation of the nodes in S under which a perfect cyclic d-distance b ′ -matching exists, where b ′ is as defined in (7).This implies the statement of the theorem, since the former problem is NP-complete by Lemma 2. Firstly, assume that we have a permutation s 1 , . . ., s n of S under which a perfect d-distance b ′ -matching M exists.Since the M -degree of every node in S is exactly 2, the size of M is 2|S|.Furthermore, d = |S|/2, therefore the degree of t in M is at most 2. From this, the degree of t in M is exactly 2 by |S| = |T |, therefore M is the node-disjoint union of cycles.If one of the neighbors of a node s ∈ S is t ∈ T , then t has a uniquely defined other neighbor, since there exists exactly one node in S whose cyclic distance is at least |S|/2 from s.The same holds for the other neighbor of s.So, for every s ∈ S, the two neighbors of it have the same two neighbors, which gives a cycle of length 4. Hence the edges of the cyclic d-distance b ′ -matching cover all nodes and is the union of node-disjoint 4-cycles.
Secondly, if there is a set of node-disjoint cycles of length 4 covering the nodes of G, then we can construct a proper permutation of S as follows.For each cycle, take one of its nodes in S, and put them in the first |S|/2 positions of the permutation in arbitrary order.This clearly determines the order of the rest of the nodes in S, since for any node s from the first |S|/2 nodes, there is exactly one other node in S having a common neighbor with s, so this must be placed exactly |S|/2 positions after s.

⊓ ⊔
Note that the proofs of Theorems 7 and 8 also show that the problem is NPcomplete when b(s) = b(t) = 2 for all s ∈ S and t ∈ T both in the cyclic and the non-cyclic case.Next, Theorems 7 and 8 are extended to the case when b(s) ≥ 2 for all s ∈ S -instead of b(s) = 2.
Theorem 9 Both in the cyclic and the non-cyclic case, it is NP-complete to decide whether there exists a permutation of the nodes in S such that there is a perfect (cyclic) d-distance b ′′ -matching under this permutation, where b ′′ (s) ≥ 2 for all s ∈ S and b ′′ (t) = ∞ for all t ∈ T .Proof In both cases, the problem is in NP.We prove the theorem for the cyclic and the non-cyclic versions simultaneously by showing that finding a permutation under which a perfect (cyclic) d-distance b ′′ -matching exists is more general than finding a permutation under which a perfect (cyclic) d-distance b ′ -matching exists, where b ′ is as defined in (7).
We modify the input graph of the perfect (cyclic) d-distance b ′ -matching problem as follows.For each s ∈ S, add (b ′′ (s) − 2) new nodes to T , and connect them to s.Let F denote the set of the newly added edges.We prove that there is a permutation of S under which a perfect (cyclic) d-distance b ′ -matching exists in the original graph if and only if there is a perfect (cyclic) d-distance b ′′ -matching in the new graph under the same permutation of S.
Firstly, if there is a perfect (cyclic) d-distance b ′ -matching M ′ in the original graph under some permutation of S, then M ′ ∪ F is a perfect (cyclic) d-distance b ′′ -matching in the new graph under the same permutation.
Secondly, for the reverse direction, let M ′′ denote a perfect (cyclic) d-distance b ′′ -matching in the new graph under some permutation of S. Take the edge set M ′′ \ F , and remove all except two of the edges incident to each node s ∈ S.This way one gets a feasible perfect (cyclic) d-distance b ′ -matching in the original graph under the same permutation.
This completes the proof both in the cyclic and the non-cyclic version by Theorems 7 and 8, respectively.⊓ ⊔ 4.2 (Cyclic) d-distance b-matchings for small d By Theorems 7 and 8, finding an optimal permutation is hard when d = |S|/2.We show that the problem is also hard for any d ≥ 2 that is polynomially smaller than |S|, which, as a special case, implies that even the case d = 2 is NP-complete.
Theorem 10 It is NP-complete to decide whether there exists a permutation of the nodes in S such that there is a perfect (cyclic) d-distance b ′ -matching under this permutation, where ) for some constant c > 0, and Proof The problem is clearly in NP.We give a reduction from the Hamiltonian path problem in an undirected simple graph G ′ = (V ′ , E ′ ) to the non-cyclic case when d = 2, then we show that the problem stated in the theorem includes this as a special case.Construct a bipartite graph G = (S, T ; E) such that S = V ′ and T is the edge set of the complement of G ′ .For each t = uv ∈ T , add edges ut and vt to G. We prove that there exists a Hamiltonian path in G ′ if and only if there is a permutation of the nodes in S under which a perfect d-distance b ′ -matching exists, where d = 2 and b ′ is as defined in (8).Firstly, assume that M is a perfect d-distance b ′ -matching in G under the permutation s 1 , . . ., s n of S. By the definition of b ′ , this means that M = E, therefore {s i t, s i+1 t} ⊆ E for all i ∈ {1, . . ., n − 1} and for all t ∈ T .But then s i s i+1 ∈ E ′ for all i ∈ {1, . . ., n − 1}, which means that s 1 , . . ., s n defines a Hamiltonian path in G ′ .
Secondly, assume that a Hamiltonian path in G ′ traverses the nodes of G ′ in the order s 1 , . . ., s n .This means that there is an edge e i in E ′ between s i and s i+1 for all i ∈ {1, . . ., n − 1}, that is, {s i t, s i+1 t} ⊆ E for all i ∈ {1, . . ., n − 1} and for all t ∈ T .This means that M = E is a perfect d-distance b ′ -matching in G under the permutation s 1 , . . ., s n of S, where d = 2 and b ′ is as defined above.This completes the proof for d = 2 in the non-cyclic case.Now we prove that if n = |S| = d(ℓ + 1) − 2 for ℓ = Ω(n c ) and d ≥ 2, then the non-cyclic problem includes the case d = 2 for G ′ = (S ′ , T ′ ; E ′ ) with |S ′ | = 2ℓ.Let G = (S, T ; E) be a copy of G ′ , and add a new node sq,r to S for all q ∈ {1, . . ., ℓ+1} and r ∈ {1, . . ., d − 2}.For r ∈ {1, . . ., d − 2}, also add a new node t r to T and all edges between t r and {s r,1 , . . ., sr,ℓ+1 }.
Firstly, we show that if there is a permutation s 1 , . . ., s n of S under which E is feasible in G, then there is a permutation of S ′ under which E ′ is feasible in G ′ .We claim that s id−1 , s id ∈ S ′ for all i ∈ {1, . . ., ℓ}.By contradiction, suppose that s id−1 = sq,r or s id = sq,r for some q and r.Let t r denote the only neighbor of sq,r .As E is feasible, all neighbors of t r on the left of sq,r are among the nodes s 1 , . . ., s id−d .Similarly, all neighbors of t r on the right of sq,r are among the nodes s id−1+d , . . ., s n .Therefore, the degree of t must be at most which contradicts the fact that the degree of t r is (ℓ + 1) by the construction of G.This means that s id−1 , s id ∈ S ′ for all i ∈ {1, . . ., ℓ}, as we claimed.Since the size of S ′ is 2ℓ, the nodes s id−1 , s id for i ∈ {1, . . ., ℓ} are exactly the nodes in S ′ .Therefore, every interval of length d contains two nodes in S ′ , which means that E ′ is a feasible solution for G ′ and d = 2 under the permutation of S ′ obtained by restricting s 1 , . . ., s n to S ′ .Secondly, we prove that if there is a permutation s ′ 1 , . . ., s ′ |S ′ | of S ′ under which E ′ is feasible, then there is a permutation of S under which E is feasible.Concatenate the subsequences sq,1 , . . ., sq,d−2 for q = 1, . . ., ℓ + 1.Then, insert s ′ 2q−1 and s ′ 2q in this order right after sq,d−2 for q ∈ {1, . . ., ℓ}.We claim that E is feasible under the permutation obtained this way.As an interval of length d includes exactly two nodes in S ′ and these nodes appear in the order given by s ′ 1 , . . ., s ′ |S ′ | , the edge set E ′ is feasible.For each r ∈ {1, . . ., d − 2}, the neighbors of t r are the nodes s1,r , . . ., sℓ+1,r , which do not appear in an interval of length d in the permutation defined above.This means that the edge set E \ E ′ is feasible as well.Since E ′ and E \ E ′ are node-disjoint, this implies that E is also feasible, which was to be shown.This completes the proof in the non-cyclic case.
To show the hardness of the cyclic case, one can give a reduction from the Hamiltonian cycle problem.The proof is a straightforward modification of the reduction for the non-cyclic case, therefore it is left to the reader.
⊓ ⊔ In the previous theorem, we did not assume that the coordinates of b are small, unlike in Theorems definition of b ′ .Let P (n, d, k) be the probability that a given edge is added to the solution.By definition, Clearly, E(n, d, k) = kP (n, d, k).Observe that holds for all n, d, k ∈ N provided that n ≥ dk, because dk is the smallest possible size of S when the degree of t can be k in M, and if the number of nodes in S is larger than dk, then all additional nodes must be isolated, hence the probability of an edge being added can be only larger.The value of P (dk, d, k) can be expressed as follows.
where the first equation holds by (10), and the third one because the product is telescopic.From this, we immediately get that P (dk, d, k) is monotone decreasing in d for all k ∈ N, and it tends to 1 − 1 k k−1 as d goes to infinity for all k ∈ N.
This implies that holds for all d, k ∈ N. By ( 11), ( 12) and ( 13), P (n, d, k) ≥ α(d, k) holds for all n, d, k ∈ N provided that n ≥ dk, which completes the proof of the unweighted case when |T | = 1.The bounds given by ( 12) and ( 13) are (asymptotically) tight, therefore (9) cannot be improved, as we stated in the theorem.
Since all edges incident to t appear in the output of Algorithm 1 with equal probability, the expected weight of the returned edges is at least α(d, k)w( M ∩ ∆(t)), which was to be shown in the weighted case when |T | = 1.
We continue with the general weighted case, that is, when the size of T is arbitrary.Let S C denote the set of all cyclic permutations of S, and let M π ⊆ M denote the feasible cyclic d-distance b-matching returned by the algorithm when it selects the cyclic permutation π ∈ S C .The following computation leads to the bound stated in the theorem.It is well known that ( 9) is monotone decreasing and tends to 1 e as k and d go to infinity.This immediately implies the following.
Theorem 12 Algorithm 1 outputs a cyclic permutation s 1 , . . ., s n of S and a feasible cyclic d-distance b-matching whose expected weight is at least 1 e times the weight of the heaviest cyclic d-distance matching under all permutations.This lower bound is tight.Now, we turn to the non-cyclic case.

Algorithm 2
Randomized approximation algorithm for S-permutations Generate a permutation s 1 , . . ., sn of S uniformly at random.M := ∅ for t ∈ T do for i = 1, . . ., n do if s i t ∈ M and s max{1,i−d+1} t, . . ., s i−1 t / ∈ M then M := M ∪ {s i t} output s 1 , . . ., sn and M Algorithm 2 is the analog of Algorithm 1 for the non-cyclic d-distance bmatching problem.First, the algorithm finds a maximum-weight b ′ -matching M in G for the b ′ defined in Algorithm 2, and takes a random permutation of S.Then, for each t ∈ T , it selects an edge s i t ∈ M if t and the (at most) (d − 1) nodes before s i induce no edges in M .It returns the chosen permutation and the union of the selected edges.Similarly to Algorithm 1, the edge set returned by the algorithm is a feasible d-distance b-matching under the chosen permutation.
The following theorem for the non-cyclic version is analogous to Theorem 11.
Theorem 13 Algorithm 2 outputs a permutation s 1 , . . ., s n of S and a feasible d-distance b-matching whose expected weight is at least Clearly, E(n, d, k) = kP (n, d, k).Observe that is the smallest possible size of S when the degree of t can be k in M , and if the number of nodes in S is larger, then all the extra nodes are isolated, hence the probability that an edge is added can be only larger.Let n = (d − 1)k + 1.The value of P (n, d, k) can be expressed as follows.
where the last equation holds by rearranging the products.Let f (d, k) and g(d, k) denote the first and the second summand in the right hand-side of ( 15), respectively.Clearly, (16) To derive the limit of f (d, k), we need the following computation.
where the first equation holds by the definition of f , the second one by rearranging the product, and the fourth one by applying the binomial identity for all k ∈ N. By ( 15), ( 16) and ( 18), P (n, d, k) tends to as d goes to infinity for all k ≥ 2. Observe that P (n, d, k, i) is non-increasing in d, and therefore so is P (n, d, k) for all n, k ∈ N.This implies that  20) are (asymptotically) tight, therefore ( 14) cannot be improved, as we stated in the theorem.Since all edges incident to t appear in the output of Algorithm 2 with equal probability, the expected weight of the returned edges is at least β(d, k)w( M ∩ ∆(t)), which was to be shown in the weighted case when |T | = 1.
The general weighted case, when the size of T is arbitrary, can be handled by a computation similar to the end of the proof of Theorem 11.From this, we get that E(n, d, k) ≥ β(d, k)w(M * ), which completes the proof.

⊓ ⊔
It is easy to see that ( 14) is monotone decreasing and tends to 1 e as k and d go to infinity.This immediately implies the following.Theorem 14 Algorithm 2 outputs a permutation s 1 , . . ., s n of S and a feasible d-distance b-matching whose expected weight is at least 1 e times the weight of the heaviest d-distance matching under all permutations.This lower bound is tight.
By Theorems 11 and 13, the expected approximation guarantees achieved by Algorithms 1 and 2 are better than e when any of d, n d or the largest degree in T is small.For example, if d = 2, then both algorithms return a 2-approximate solution in expectation.
Both algorithms are easy to de-randomize using conditional probabilities as follows.Observe that the conditional probability of an edge being added to the solution can be easily computed under the condition that the positions of some of the nodes are already fixed.Therefore, one can try to put each node to the first place, and choose the one that gives the highest (conditional) expectation.Then try each of the remaining nodes at the second position and put the best one there, and so on.The weights of the outputs of the de-randomized algorithms are clearly at least as large as the expected weight of the solutions found by the randomized algorithms.
In the rest of this section, an improved approximation algorithm for the noncyclic case is presented.Algorithm 2 includes an edge st in the solution set if and only if t has no neighbors among the (d − 1) nodes in front of s.A more efficient approach is to run a greedy algorithm enumerating the edges incident to t from left to right for each t ∈ T , in other words, the modified algorithm generates a random permutation of S and executes algorithm T -Greedy as described in [13].Clearly, the solution returned by the modified algorithm is at least as good as the one found by Algorithm 2, provided that they choose the same random permutation.We propose the following conjecture: Note that the conjecture is based on an extensive computational study.We computerverified the statement in all cases when |S| ≤ 1000 and d ≤ 100.Enumerating all such instances directly is hopeless, but one can design a non-trivial dynamic programming algorithm for computing the exact expected value in the case |S| = (k − 1)d + 1 and |T | = 1.Similarly to the proof of Theorem 13, this confirms the conjecture for all problem instances with |S| ≤ 1000 and d ≤ 100.
Note that it is not difficult to construct an example for each d in which the expected weight of the returned edges is exactly 1 2 d 2 +d+2 d 2 +d times the optimum, so one cannot hope to improve the bound above.

Open questions
An FPT algorithm parameterized by d was given for the d-distance matching problem [13].A straightforward generalization of this approach gives an FPT algorithm parameterized by both d and max v∈V b(v) for the d-distance b-matching problem.It is not clear whether an FPT algorithm parameterized only by d exists for this problem.The d-distance matching problem was shown to be solvable in polynomial time when the size of T is a constant [13].Is the problem polynomial-time solvable when the size of T is taken as a parameter?
It remains open whether an optimal permutation can be found when both d and the coordinates of b are constants.Improving the e-approximation algorithms for finding the best permutation -and in particular proving Conjecture 1seems to be a challenging problem.
By Theorems 5 and 6, finding a permutation maximizing the weight of the heaviest (cyclic) d-distance b-matching can be solved when b(s) = 1 for all s, and it is NP-hard when b(s) = 2 for all s ∈ S. What can we say about the cases between these two extremes?It is easy to see that the problem is solvable when b(s) ∈ {1, 2} and there are only a constant number of nodes for which b is 2. A natural question is whether an FPT algorithm parameterized by the number of nodes for which b is 2 exists.
The construction given in Theorem 8 seems to be easy to modify to show that the optimization version of the cyclic problem is APX-hard.We do not know whether the non-cyclic optimization problem behaves differently in this regard.
The integrality gap of (LP1') is at most (2 − 1 d ) in the cyclic case when the size of S is divisible by (2d − 1).We believe that this bound holds regardless of the size of S, but the proof of Theorem 1 does not seem to generalize to this case.
In the non-cyclic case, the integrality gap is at most (2 − 2 d ), but this does not seem to be tight.The exact value of the integrality gap remains unknown.
In a natural generalization of the problem, a bound g(t, I) ∈ Z + is given on the number of edges induced by I and t for each t ∈ T and for each interval I of length d in S. When g ≡ 1, we get back the d-distance b-matching problem.Some of the results presented in this paper also apply to other special cases of this more general setting.For example, (LP1) easily extends to the more general problem by changing the right hand-side of (1c) to g(s i , R d (s i )), and adding x ≤ 1.It is not hard to see that the bounds on the integrality gap given by Theorems 1 and 2 hold for any uniform g.
The problem has several other natural generalizations.For example, pose distance constraints on both node classes, or drop some of the distance constraints, etc., which are subjects for further research.
Motivated by the position-based scheduling problem on a single machine [8], we introduce the position-based optimal permutation problem, in which placing s ∈ S at each position has an associated cost, and the goal is to find a minimum-cost permutation of S under which a perfect d-distance matching exists.When the cost function is uniform, the problem can be solved by Theorem 5.This approach does not seem to work for other cost functions, so it is an exciting open question whether this problem is polynomial-time solvable.

Acknowledgement
The author is grateful to Sára Hanna Tóth for discussions and for finding the gadget used in the proof of Theorem

− 1 d
) is a tight upper bound on the integrality gap of the natural IP model of the d-distance b-matching problem provided that the size of S is divisible by (2d − 1).Then, we show that (2 − 2 d ) is an upper bound on the integrality gap of the non-cyclic version for d ≥ 2 -without any restriction on the size of S. The proofs also give two approximation algorithms with approximation factors matching the bounds above.Consider the following LP-relaxation of the natural IP model for the weighted d-distance b-matching problem.max e∈E w e x e (LP1) s.t.

Fig. 1 :
Fig. 1: Illustration of the proof of Theorem 3.Each hyperedge is represented by a unique line style.The highlighted 3-dimensional matching in (a) corresponds to the highlighted solution in (b).

7 and 8 .
It remains open whether the problem becomes tractable when d = 2 and the coordinates of b are small, for example b ≡ 2.

1 dd− 1
) holds for all d, k ∈ N. Similarly, P (dk, d, k) is monotone decreasing in k for all d ∈ N, and it tends to 1 − as k goes to infinity for all k ∈ N.This implies that P (dk, d, k) ≥ 1 − 1 d d−1 k)w(M * ), where M * is an optimal cyclic d-distance b-matching under all permutations.The first inequality holds by the case |T | = 1, and the second one because any cyclic d-distance b-matching must respect the degree bounds posed by b ′ and M is a heaviest b ′ -matching for the b ′ defined in Algorithm 1.This completes the proof of the theorem.⊓ ⊔

Conjecture 1
Generating a random permutation of S, algorithm T -Greedy finds a feasible d-distance b-matching whose expected weight is at least 1 2 d 2 +d+2 d 2 +d > 1 2 times the weight of the heaviest d-distance b-matching under all permutations.

3 .
This research has been implemented with the support provided by the Ministry of Innovation and Technology of Hungary from the National Research, Development and Innovation Fund, financed under the ELTE TKP 2021-NKTA-62 funding scheme, by the Ministry of Innovation and Technology NRDI Office within the framework of the Artificial Intelligence National Laboratory Program, and by the Lendület Programme of the Hungarian Academy of Sciences -grant number LP2021-1/2021.
. , n 2d−2 − 1}, where i ∈ {1, . . ., 2d − 2} and R d is to be taken in the cyclic sense.Let E i consist of the edges induced by S i and T , and let G i = (S, T ; E i ) for i ∈ {1, . . ., 2d − 2}.Just as in the proof of Theorem 1, we prove that the polytope defined by (LP1) is integer for G i .Fix an arbitrary order t 1 , . . ., t k of the nodes in T .The columns of the matrix of the program, that is the variables, are ordered as follows.
11 t 1 t 2 t 3 t 4 t 5 t 6 (a) A feasible matching for d = 4.The indeces of the nodes correspond to the first step of the construction described in the proof.In this case, k = 2 and r = 3.
2 , v 3 , v 4 and v e 1 , v e 2 , v e 3 , v e 4 are in the subgraph, then delete these two cycles and add the cycles formed by the nodes v 1 , v e 1 , v e 2 , v 2 and v 3 , v e 3 , v e 4 , v 4 instead.Clearly, the new cycles are node-disjoint and cover every node of G. Now, construct a 4-dimensional matching F in H by adding the hyperedge e = (v 1 , v 2 , v 3 , v 4 ) to F if and only if the cycle formed by the nodes v e nodes cover the nodes v 1 , v 2 , v 3 , v 4 , and because all nodes of G are in exactly one of the selected 4-cycles.⊓⊔ Now we are ready to prove the analogous theorem for the cyclic case.
(14)mes the weight of the heaviest d-distance b-matching under all permutations, where k = max t∈T b ′ (t) for the b ′ defined in Algorithm 2. This lower bound is tight.Proof The outline of the proof is similar to that of Theorem 11, but the technical details are slightly more complicated.Let E(n, d, k) denote the expected weight of the solution returned by the algorithm, and let β(d, k) denote the lower bound given by(14).Similarly to the proof of Theorem 11, consider the case when T = {t} and the problem is unweighted.Without loss of generality, one can assume that k ≥ 2 and d ≤ n.Let P (n, d, k) be the probability that a given edge is added to the solution, and let P (n, d, k, i) denote the probability that the edge incident to s i is added to the solution.By definition, n i=1 P (n, d, k, i),and