WorksComputer Science
A 2/3-Approximation Algorithm for the Residual Maximum Matching Problem in General Graphs
Abstract
The residual maximum matching problem asks for a maximum matching whose deletion leaves a graph with the largest possible matching number. For unweighted graphs, previous work provides a -approximation guarantee in general graphs and a guarantee in graphs with a perfect matching. We present a -approximation algorithm running in time, extending the latter guarantee to general graphs. The algorithm improves the residual matching number through single-edge exchanges involving free vertices. We prove that, for any maximum matching that admits no further improvement by such exchanges, the residual matching number is at least of the optimum, and we give an example showing that this bound is tight.
Introduction
An edge coloring partitions the edges of a graph into matchings, with each color class consisting of edges that have no common endpoints. This structure also describes pairwise tasks performed in successive stages: tasks in the same stage cannot share an endpoint, whereas vertex resources can be reused in different stages. When two stages have strict priorities, the first stage must accommodate as many tasks as possible, and the number of tasks in the second stage is then maximized over the remaining edges. The resulting optimization problem asks for a maximum matching whose deletion leaves a graph with the largest possible matching number.
In their work on edge coloring, Gabow, Nishizeki, Kariv, Leven, and Terada introduced the lexicographical matching problem, which lexicographically maximizes the cardinalities of two edge-disjoint matchings, and established related hardness results [1]. This model is equivalent to the residual maximum matching problem. Kamalian and Mkrtchyan further studied residual matching numbers after the deletion of a maximum matching and proved that the associated optimization problems remain NP-hard even for connected bipartite graphs of maximum degree three [2]. Once the first matching is fixed, a maximum matching of the residual graph can be found in polynomial time; the difficulty lies in choosing the first maximum matching.
Let denote the matching number of , and let and denote, respectively, the largest and smallest residual matching numbers obtained by deleting a maximum matching. Khojabaghyan and Mkrtchyan proved that for every graph and that when has a perfect matching [3]. Thus, an arbitrary maximum matching gives a 1/2-approximation in general graphs and a 2/3-approximation in graphs with a perfect matching. Mkrtchyan subsequently studied the approximation complexity of these parameters [4], using the above 1/2 guarantee for general graphs and proving that, unless , for every there is no polynomial-time -approximation algorithm for on connected bipartite graphs.
The maximum 2-edge-colorable subgraph problem, in contrast, maximizes the total number of edges in two edge-disjoint matchings. Kosowski gave a 5/6-approximation algorithm [5], and Chen, Konno, and Matsushita improved the guarantee to approximately 0.842 [6]. Chen, Fan, and Wang further studied parameterized algorithms for finding two edge-disjoint matchings and approximation algorithms for their total weight [7]. These results optimize the combined size or weight of the two matchings, whereas the lexicographical model requires the first matching to have cardinality exactly . A maximum 2-edge-colorable subgraph need not contain a maximum matching of the original graph [4]. Consequently, approximation guarantees for the combined objective do not directly yield guarantees for .
We improve the above 1/2 baseline for general graphs to 2/3. Our algorithm uses single-edge exchanges involving free vertices: an edge of the current maximum matching is replaced by an adjacent edge whose other endpoint is free, and the exchange is accepted only if it increases the residual matching number. Each accepted exchange preserves the maximum cardinality of the first matching and increases the residual matching number by one. Using standard maximum matching algorithms [8, 9], the procedure runs in time and space. The key observation is that, at termination, every edge of the maximum matching whose individual addition to the residual graph increases its matching number, called a critical edge, has neither endpoint adjacent to a free vertex. Combining this structural property with a deficit bound for noncritical edges and an assignment argument on oriented alternating paths and cycles, we establish the 2/3 approximation guarantee, extending the ratio for graphs with a perfect matching to general graphs. A seven-vertex example shows that the 2/3 bound implied by this termination condition is tight.
Problem definition and preliminaries
Problem definition
Let be a finite simple undirected graph with and unweighted edges. Write for the cardinality of a maximum matching of , and let be the set of all maximum matchings of . For an edge set , let denote the set of its endpoints, and let denote the graph obtained by deleting only the edges of and retaining all vertices. For an edge not already present in a graph , let denote the graph obtained by adding .
The objective is to maximize the residual matching number after deleting a maximum matching:
Different maximum matchings may yield different residual matching numbers. For example, the five-vertex path in Figure 1 has , but deleting the maximum matchings and gives and , respectively.

Figure 1. Residual graphs corresponding to different maximum matchings.
Symmetric difference and alternating paths
For two matchings and , their symmetric difference is . In the graph formed by these edges, every connected component containing an edge is an alternating path or an even cycle, with edges of and appearing alternately. If the first and last edges of a path both belong to , then the path contains one more -edge than -edge. Replacing the -edges on the path by its -edges therefore yields a matching with one more edge than [8].
In particular, if and are both maximum matchings of the same graph, every path component must contain equal numbers of the two types of edges. Otherwise, exchanging the two types along that path would increase one of the matchings, contradicting its maximum cardinality. Thus, every connected component of containing an edge is an alternating path of even length or an alternating cycle, with equal numbers of -edges and -edges [9].
The single-edge exchange algorithm
The exchange criterion
Let be the current maximum matching, and let and . The vertices in are called -free vertices. An edge is critical with respect to if , and noncritical if .
Let be an -free vertex, and suppose that and . Set
Since is free, is a matching of the same cardinality as and is therefore also maximum. Figure 2 illustrates this exchange.

Figure 2. The single-edge exchange . Vertex is free before the exchange, and is free afterwards. Thick solid lines represent edges of the current maximum matching; dashed lines represent residual edges.
Lemma 1. For the exchange in (2), if and only if is critical.
Proof. Adding one edge increases the matching number by at most one. If is critical, then . Take a matching of cardinality in . It must contain ; otherwise it would be a matching in , contradicting . Since and share the vertex , the matching does not contain and is therefore also a matching in . Together with , this gives
Hence .
Conversely, if , then the inclusion gives
Thus , so is critical.
The algorithm and its termination property
Algorithm 1 starts with an arbitrary maximum matching and repeatedly performs the improving exchanges described in Lemma 1.
Proposition 1. Algorithm 1 performs at most successful exchanges. Its output is a maximum matching, and every edge of with an endpoint adjacent to a vertex in is noncritical; that is,
Proof. By Lemma 1, each successful exchange preserves the maximum cardinality of and increases the integer by one. Since , the number of exchanges is bounded. At termination, every matching edge with an endpoint adjacent to a free vertex has been tested without yielding an improvement. Thus property (S) holds.
Algorithm 1 Single-edge exchange algorithm
Input: A finite simple undirected graph .
Output: A maximum matching of and a maximum matching of the residual graph .
Find an arbitrary maximum matching of .
Set . Find a maximum matching of , and set and .
Scan the edges in a fixed order. If neither endpoint has a neighbor in , continue the scan.
Otherwise, choose any vertex with and , and compute .
If , set and return to Step 2.
If the scan ends without a successful exchange, output .
Equivalently, property (S) states that neither endpoint of any critical edge in has a neighbor in .
A deficit bound for noncritical edges
Lemma 2. Let be a maximum matching of a graph , and let and . Let be a matching of cardinality in , and let consist of edges that are noncritical with respect to . If , then
Proof. Take a maximum matching of and set . By the vertex-disjointness assumption, is a matching and . In , let count the path components with one more -edge than -edge, and let count those with one more -edge than -edge. The remaining components do not affect the difference in cardinalities, so
Each path counted by contains at least two edges of . Indeed, if it contains no edge of , as in Figure 3(a), then the entire path lies in and is an -augmenting path, contradicting the maximum cardinality of . If it contains exactly one edge , as in Figure 3(b), then the entire path lies in , and augmenting along it yields a matching of cardinality . However, is noncritical, so , a contradiction.

Figure 3. Augmenting paths in Lemma 2.
These paths are pairwise vertex-disjoint, and each contains at least two edges of . They therefore contain at least distinct edges of in total, giving . Together with (5), this yields , which proves the claim.
The approximation guarantee for general graphs
Throughout this section, let be a maximum matching satisfying property (S), and write and . Take an optimal matching pair , where is a maximum matching of , is a maximum matching of , and . For brevity, write .
The comparison matching and noncritical conflict edges
Define
We call the conflict edge set. Since , we have . Moreover, is a matching in , so
Let . Figure 4 illustrates the relationships among these edge sets.

Figure 4. Relationships among the matching edge sets.
Deleting the conflict edges from gives a matching of cardinality in . Following the comparison matching construction used in [3] to prove the bound for graphs with a perfect matching, let and set
We have . Indeed, suppose that . Since the endpoints of are already covered by , the matching property of implies , contradicting . Furthermore, . Because is a matching, the edges of have no common endpoints with the edges of , and hence all their endpoints lie outside . Both endpoints of every edge of , on the other hand, lie in . Thus and are vertex-disjoint. As both are matchings in ,
is a matching in , satisfying
Figure 5 illustrates this construction: after deleting the conflict edge set from , we add the edges of between endpoints of to obtain the matching in .

Figure 5. Construction of the matching . Black solid lines represent edges of , and blue dashed lines represent .
Let be the set of noncritical edges in that are vertex-disjoint from , and write .
Lemma 3. The sets defined above satisfy
Proof. Since , the set is a matching disjoint from , and each of its edges is noncritical with respect to . As and is a matching, is vertex-disjoint from ; by definition, is also vertex-disjoint from . Hence . Applying Lemma 2 to in (8) proves the claim.
An assignment argument on oriented alternating components
The remaining conflict edges consist of critical edges and noncritical edges sharing an endpoint with an edge of . We use the alternating structure of to bound their number.
Lemma 4. The sets defined above satisfy
Proof. Since and are both maximum matchings, every component of containing an edge is an alternating path of even length or an even cycle. Orient each path from its -free endpoint to its -free endpoint, and choose either cyclic orientation for each cycle. Then each edge of is immediately followed by a unique adjacent edge of , as illustrated in Figure 6.

Figure 6. Oriented alternating components. Thick solid lines represent edges of , and dashed lines represent edges of . Each path is oriented from its -free endpoint to its -free endpoint, and each cycle is given a fixed cyclic orientation.
For a critical edge , let be the edge of immediately following it. There must be an edge immediately after . On a cycle, this follows from the alternating structure. On a path, if were the last edge, it would join an endpoint of to an -free vertex; property (S) would then force to be noncritical, a contradiction. Thus , , are three consecutive edges. If , both endpoints of lie in , so ; assign to . If , assign to .
For a noncritical edge , the definition ensures that shares an endpoint with at least one edge of ; assign to any such edge. Every edge of has now been assigned exactly once. The three cases are illustrated in Figure 7.

Figure 7. Assignment of conflict edges.
Each edge receives assignments only from edges of sharing an endpoint with it. Since is a matching, each endpoint of is incident to at most one edge of , so receives at most two assignments. An edge receives an assignment only under the second rule for critical edges, which requires the consecutive order , , . Once the orientation is fixed, the predecessor of and the predecessor of on the path or cycle are both unique. Hence receives at most one assignment. The two types of receiving edges accommodate at most assignments in total, and therefore .
The main theorem
Theorem 1. Let be a maximum matching of . If satisfies property (S), then
Proof. By Lemmas 3 and 4,
Substituting and gives
Using from (6), we obtain
Thus . □
Running time and tightness
Running time
Theorem 2. With a standard implementation of maximum matching in general graphs, Algorithm 1 runs in time and space.
Proof. A maximum matching in a general graph can be found in time and space [8, 9]. Each scan considers at most matching edges. For each edge, finding a free neighbor takes time, and the maximum matching subroutine is called at most once to compute the matching number after adding that edge back. Thus each scan takes time. By Proposition 1, there are at most successful exchanges. Initialization and the recomputation of a residual maximum matching in each round are also covered by this bound. Hence the total running time is
An adjacency-matrix representation of the graph, together with sequential reuse of the workspace of the maximum matching subroutine, requires total space.
Tightness of the termination condition
Proposition 2. There exist a graph and a maximum matching satisfying property (S) such that . Thus the approximation bound implied by property (S) alone is tight.
Proof. Let and
Set , as shown in Figure 8(a). Since , we have , so is maximum. The nonisolated part of the residual graph is the path , and thus .

Figure 8. A terminal instance attaining the bound.
The only -free vertex is 0, whose only neighbors are 1 and 4. Hence 14 is the only matching edge that needs to be tested. The nonisolated vertices of are still 0, 1, 2, 4, 5, so its matching number is at most two. Consequently, , and property (S) holds. On the other hand, and are two edge-disjoint matchings, each with three edges, as shown in Figure 8(b). Thus , and .
Conclusion
We have presented a -approximation algorithm for the residual maximum matching problem in general unweighted graphs. Through single-edge exchanges involving free vertices, the algorithm obtains a maximum matching satisfying a local termination condition. A deficit bound for noncritical edges and an assignment argument on oriented alternating components together establish the approximation guarantee implied by this condition, and an example attains the bound. Further research may investigate whether stronger local improvement conditions can yield a ratio better than , and how the structural analysis developed here can be extended to the residual maximum matching problem in weighted graphs.
Declaration of generative AI and AI-assisted technologies in the manuscript preparation process
The authors used an AI assistant for translation and language revision, manuscript organization, mathematical discussion, and reference checking. The authors reviewed and edited the content as needed and assume full responsibility for all content.
References
- [1]H.N. Gabow, T. Nishizeki, O. Kariv, D. Leven, O. Terada, Algorithms for Edge-Coloring Graphs, Technical Report 41/85, September 1985. https://web.eecs.umich.edu/~pettie/matching/Gabow-Nishizeki-etal-algorithms-for-edge-coloring.pdf.
- [2]R.R. Kamalian, V.V. Mkrtchyan, On complexity of special maximum matchings constructing, Discrete Mathematics 308 (10) (2008) 1792–1800. doi:10.1016/j.disc.2007.04.029.DOI
- [3]A. Khojabaghyаn, V.V. Mkrtchyan, On upper bounds for parameters related to the construction of special maximum matchings, Discrete Mathematics 312 (2) (2012) 213–220. doi:10.1016/j.disc.2011.08.026.
- [4]V. Mkrtchyan, Three results towards approximation of special maximum matchings in graphs, Discrete Applied Mathematics 371 (2025) 127–136. doi:10.1016/j.dam.2025.04.005.DOI
- [5]A. Kosowski, Approximating the maximum 2- and 3-edge-colorable subgraph problems, Discrete Applied Mathematics 157 (17) (2009) 3593–3600. doi:10.1016/j.dam.2009.04.002.DOI
- [6]Z.-Z. Chen, S. Konno, Y. Matsushita, Approximating maximum edge 2-coloring in simple graphs, Discrete Applied Mathematics 158 (17) (2010) 1894–1901. doi:10.1016/j.dam.2010.08.010.DOI
- [7]Z.-Z. Chen, Y. Fan, L. Wang, Parameterized and approximation algorithms for finding two disjoint matchings, Theoretical Computer Science 556 (2014) 85–93. doi:10.1016/j.tcs.2014.03.030.DOI
- [8]J. Edmonds, Paths, trees, and flowers, Canadian Journal of Mathematics 17 (1965) 449–467. doi:10.4153/CJM-1965-045-4.DOI
- [9]Z. Galil, Efficient algorithms for finding maximum matching in graphs, ACM Computing Surveys 18 (1) (1986) 23–38. doi:10.1145/6462.6502.DOI