I have a set of edges [m,n] of a bipartie graph U, V with a cost assigned to each edge and I need to find the minimum cost edge-cover covering all nodes in U, V. There is one additional constraint is that I should not have a length 3 path ( meaning if m in [m,n] is included in other edges then n should not happen on other edges than [m,n] )

I have read that this problem can be reduced to a minimum cost weighted bipartie perfect matching, but I could not find the way to do that.

The relation is not straightforward to me since a node m can be connected to different nodes in the right hand partie and vice versa.

  • 2
    $\begingroup$ It should be MAXIMUM matching; a minimum matching can be nothing than an empty set. Hint: An edge-cover is a superset of the max matching. Your additional constraint is redundant, and can be derived from the "minimum cost". $\endgroup$
    – Yixin Cao
    Commented Dec 10, 2012 at 14:06
  • $\begingroup$ I meant minimum cost of a weighted bipartie matching, if you are talking about the title. If so I can reformulate it this way $\endgroup$
    – Sadache
    Commented Dec 10, 2012 at 14:37
  • $\begingroup$ have you ever checked the definition of "matching"? $\endgroup$
    – Yixin Cao
    Commented Dec 10, 2012 at 18:19
  • 2
    $\begingroup$ Sadache, the confusion is that if all weights are positive, then the minimum cost matching is just an empty set. what makes more sense is consider the minimum cost matching of cardinality $k$. then a sensible choice for $k$ is the maximum cardinality of any matching in the graph. $\endgroup$ Commented Dec 10, 2012 at 20:09
  • 3
    $\begingroup$ I think the problem of finding a minimum cost edge cover, without the path length constraint, would not be research level. But with the constraint (and with negative edges) it seems nontrivial enough to me, so I am upvoting this. $\endgroup$ Commented Dec 31, 2012 at 21:45

2 Answers 2


If all edge weights are non-negative, then the minimum weight set of edges that covers all the nodes automatically has the property that it has no three-edge paths, because the middle edge of any such path would be redundant. If we assign each vertex to an edge that covers it, some edges will cover both of their endpoints (forming a matching $M$) and others will cover only one of their endpoints (and must be the minimum weight edge adjacent to the covered endpoint). If we let $c_v$ be the cost of the minimum weight edge incident to vertex $v$, and $w_e$ be the weight of $e$, then the cost of a solution is $\sum_{v\in G} c_v + \sum_{(u,v)\in M} (w_{(u,v)}-c_u-c_v)$. The first sum doesn't depend on the choice of the cover, so the problem becomes one of finding a matching that maximizes the total weight, for edge weights $c_u+c_v-w_{(u,v)}$. If you really want this to be a minimum weight perfect matching problem, then instead use weights $w_{(u,v)}-c_u-c_v$ and add enough dummy edges with weight zero to guarantee that any matching with the real edges can be extended to a perfect matching by adding dummy edges.

If the input graph can have negative edge weights, then the three-edge-path constraint becomes meaningful. In this case it's not obvious to me that there is a polynomial time solution.

  • $\begingroup$ You've shown that the minimum weight covering problem can be reduced to the maximum weight matching problem. But, can it be reduced to a 'bipartie' maximum matching problem? $\endgroup$
    – Nimrand
    Commented Oct 19, 2016 at 15:08
  • $\begingroup$ It's a maximum weight matching problem on the original graph, which was assumed in the stated problem to be bipartite. $\endgroup$ Commented Oct 19, 2016 at 18:52
  • $\begingroup$ Ah, I missed that the original graph was also bipartie. Does the same formulation work for converting a general Minimum Weighted Covering problem to a general Maximum Matching problem? I know from Marco[90] they can be converted, but this formulation seems more it would be more efficient in some cases. $\endgroup$
    – Nimrand
    Commented Oct 19, 2016 at 23:49

The solution can be found in:

Editor: Mikhail J. Atallah Handbook on Algorithms and Theory of Computation 1998, CRC Press, ISBN: 0849326494


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.