Finding the Most Weight Vertex-weighted Matchings

  • Published on

  • View

  • Download


Algorithm, Most Weight Vertex-weighted


Finding the most weight vertex-weighted matchingsGiven a bipartite graph G. For each vertex of the first part was not her weight.Required to find the maximum weight matching, iewith the largest sum of the weights of saturated peaks.Below we describe and prove the algorithm based onthe algorithm Kuhn, who will be the best solution.AlgorithmThe algorithm is extremely simple.Sort thetop of the first part, in descending order (more precisely, non-increasing) weights, and apply to the resulting graphalgorithm Kuhn.It is alleged that obtained with the maximum (in terms of number of edges) and a matching is optimal in terms of sums of weights saturated vertices (despite the fact that we actually sorting after longer use these weights).Thus, the implementation will be something like this:int n;vector g (n);vector used (n);vector order (n); // Vertex list, sorted by weight... Reading ...for (int i = 0; i