Edge cover 2026-10-24
An edge cover of a finite graph is a subset of its edges incident to every vertex. It exists if and only if there is no isolated vertex, with the empty graph covered by the empty set. A minimum-cardinality edge cover uses as few edges as possible; a minimum-weight edge cover minimizes their total weight. These objectives are related to maximum cardinality matching and maximum-weight matching, respectively, by the edge cover and matching identity and minimum-weight edge cover by matching savings.
The
max_weight_matching documentation specifies unrestricted-weight optimization by default, distinguishes the optional maximum-cardinality constraint, and gives cubic running time in the number of vertices. Its notes distinguish exact integer arithmetic from possible precision effects for floating-point weights. These details specify the maximum-weight matching subroutine needed for minimum-weight edge cover by matching savings. Minimum-weight edge cover 2026-10-25
An edge cover minimizing the sum of selected edge weights. For nonnegative weights and no isolated vertex, it is computable in polynomial time by the minimum-weight edge cover by matching savings construction. It need not have minimum cardinality.
Use minimum-weight edge cover by matching savings. Reject inputs with an isolated vertex. For every vertex , choose a cheapest incident edge and write . Define a baseline and a saving for each edge byCompute a maximum-weight matching using as its weights, allowing the empty matching in a graph and imposing no maximum-cardinality condition. Negative savings may be ignored. ReturnThis is an edge cover. Since original weights are nonnegative, removing duplicate appearances of an edge cannot increase the total, and henceTo prove optimality, take a minimum-weight edge cover and remove redundant edges until it is inclusion-minimal. Nonnegative weights ensure that its weight does not increase, so it remains optimal. As proved in (i), its components are star graphs. Choose one edge from each star graph, forming a matching in a graph .
In a star graph with center , selected leaf , and other leaves , this choice contributes to . Each other leaf has its edge available, so . Thus this contribution is at most the weight of that star graph. Summing over components yieldsSince maximizes saving, , and consequentlyAll inequalities are equalities. Therefore is a minimum-weight edge cover. This proof also handles zero weights and duplicate cheapest-edge choices.
Finding all and constructing takes time. A general-graph maximum-weight matching polynomial-time algorithm supplies the only substantial step; the documented routine runs in arithmetic time. Exact rational or integer weights avoid floating-point comparisons affecting optimality.[ref]
Maximum-weight matching documentation by NetworkX. max_weight_matching, maxcardinality=False; Notes: O(number_of_nodes ** 3), integer arithmetic for integer weights, and floating-point precision caveat