arXiv:2609.07501cs.CGSep 2026

Manuscript Offprint

arXiv:2609.07501

A new O(n log n) approach for the Euclidean maximum weight matching problem

Rostislav Staněk, Robert Arustamyan

Abstract

In a weighted graph G=(V,E)G = (V, E), the maximum weight matching problem (MWM) asks for a matching (i.e. pairing) of its vertices, such that each vertex is paired with at most one other vertex and the total sum of weights of all edges connecting paired vertices is maximised. If the vertices of the graph correspond to points in the Euclidean plane and the weights to their pairwise Euclidean distances, we get the Euclidean maximum weight matching problem (Euclidean MWM). The best optimum-solution algorithm for this problem runs in O(n2.5)O(n^{2.5}). Furthermore, there exists an FPTAS guaranteeing a (1−ϵ)(1-\epsilon)-approximation ratio, which runs in O(mϵ−1log⁡ϵ−1)O(m\epsilon^{-1}\log\epsilon^{-1}) time. Heuristics with a subquadratic running time (with respect to the number of vertices ∣V∣|V|) are known, but often yield solutions of a modest quality.

In this paper, we present a novel algorithm for solving the Euclidean MWM running in O(nlog⁡n)O(n \log n) time and providing excellent solution quality, especially for larger instances. In particular, in our computational tests, the algorithm yielded optimum or near-optimum solutions for all test instances; the worst observed optimality gap was less than 1.38%. This makes the algorithm highly attractive for practical applications, especially when exact methods become computationally prohibitive due to the size of the instance.

Keywords: Euclidean maximum weight matching problem · matching · heuristic

1 Introduction

Let G=(V,E)G = (V, E) be an undirected graph with nn vertices and mm edges; V={v1,v2,…,vn}V = \{v_1, v_2, \ldots, v_n\}, E={e1,e2,…,en}E = \{e_1, e_2, \ldots, e_n\}, where ei={ei1,ei2}e_i = \{e_{i1}, e_{i2}\} for each 1≤i≤m1 \le i \le m. A matching is a set of pairwise disjoint edges M⊆EM \subseteq E, where e1∩e2=∅e_1 \cap e_2 = \emptyset for each e1≠e2∈Me_1 \neq e_2 \in M.

*rostislav.stanek@unileoben.ac.at. Department of Mathematics and Information Technology, Technical University of Leoben, Peter-Tunner-Straße 25/I, 8700 Leoben, Austria

**robertarustamyan2@gmail.com. Department of Mathematics and Information Technology, Technical University of Leoben, Peter-Tunner-Straße 25/I, 8700 Leoben, Austria

Given an undirected graph G=(V,E)G = (V, E) and weights cec_e for each edge e∈Ee \in E, the maximum weight matching problem (MWM) asks for a matching M⊆EM \subseteq E with the maximum total weight f(G,M):=∑m∈Mcmf(G, M) := \sum_{m \in M} c_m; ff is called the objective function. The MWM is a well-studied classical combinatorial optimisation problem with direct practical applications in fields such as the social sciences (see, e.g., NAINI et al. [1]) or semiconductor manufacturing (see, e.g., XU and CHU [2]); it can also be utilised in a preprocessing step, which improves pivoting in solvers for large sparse linear systems (see, e.g., SCHENK and GÄRTNER [3]). Since the MWM is obviously equivalent to the so-called maximum cardinality minimum weight matching problem, other practical applications—among others—can be found in WU and ZHONG [4] or LU et al. [5].

It is solvable in polynomial time in the graph size (see, e.g., [6, 7, 8, 9]) – the famous Edmonds’ algorithm [10] and its implementations provided by GABOW [11] and LAWLER [12] guarantee an O(n3)O(n^3) running time. The fastest algorithm for the MWM, which guarantees an O(n2.5)O(n^{2.5}) running time, was finally provided by MICALI and VAZIRANI [13]; the authors, however, do not prove the optimality of their algorithm in this paper; a complete proof was provided later by VAZIRANI [14]. An efficient implementation capable of solving instances with millions of vertices to optimality was provided by KOLMOGOROV [15]; although this algorithm performs effectively in practice, its worst-case complexity does not improve the previous results. There exist various approximation algorithms with a fixed approximation ratio running in O(m)O(m) time (see, e.g., PREIS [16] and DRAKE and HOUGARDY [17]). Further, DUAN and PETTIE [18] present an FPTAS that finds a (1−ϵ)(1-\epsilon)-approximate maximum weight matching in O(mϵ−1log⁡ϵ−1)O(m\epsilon^{-1}\log \epsilon^{-1}) time.

Given a finite set of nn distinct points P={p1,p2,…,pn}⊂R2P = \{p_1, p_2, \ldots, p_n\} \subset \mathbb{R}^2, the Euclidean maximum weight matching problem (Euclidean MWM) asks for a matching M⊆(P2)M \subseteq \binom{P}{2} that maximises the total Euclidean distance f(P,M):=∑u,v∈M∥v−u∥2f(P, M) := \sum_{u,v \in M} \|v - u\|_2, where ∥⋅∥2\|\cdot\|_2 denotes the Euclidean norm. Since ∥v−u∥2>0\|v - u\|_2 > 0 for each u≠v∈Pu \neq v \in P, such an optimum matching is obviously perfect for ∣P∣|P| even and near-perfect for ∣P∣|P| odd; i.e. it covers all vertices in the former and all but one vertex in the latter case. Obviously, this problem is a special case of the maximum weight matching problem. So all the algorithms mentioned above can be applied directly. Several heuristics applicable to the Euclidean MWM are known. AVIS [19] provides a survey of various heuristics for the MWM and some of its special cases, which are faster than exact algorithms, but usually yield solutions much worse than the optimum. WU and LI [20] use a deep reinforcement learning (DRL) model to find high-quality solutions for the general MWM. Finally, BAUMANN et al. [21] address the Euclidean MWM in a dd-dimensional space and introduce a fast heuristic algorithm yielding maximum weight matchings of high quality, often within less than 1% of the optimum. To the best of our knowledge—and opposite to the minimisation case—neither optimum nor approximation algorithms guaranteeing a better worst-case running time are known for the Euclidean MWM.

We provide a novel algorithm for the 2-dimensional Euclidean MWM that guarantees both a worst-case computational time of O(nlog⁡n)O(n \log n) and an excellent1^1 solution quality. Moreover, the presented algorithm proves to be extremely

1^1In fact, we conjecture that the solution produced by the algorithm approaches the optimum as nn tends to infinity, i.e., that the algorithm is asymptotically optimal.

efficient from the practical point of view.

The remainder of this paper is organised as follows. In Section 2, we describe our algorithm, followed by computational results in Section 3. Final notes, conclusions and outlook are finally provided in Section 4.