@@ -31,6 +31,26 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
3131 // Check optimality of solution before returning; only works on integer weights.
3232 if ( CHECK_OPTIMUM === undefined ) CHECK_OPTIMUM = true ;
3333
34+ /**
35+ * Compute a maximum-weighted matching in the general undirected
36+ * weighted graph given by "edges". If "maxCardinality" is true,
37+ * only maximum-cardinality matchings are considered as solutions.
38+ *
39+ * Edges is a sequence of tuples (i, j, wt) describing an undirected
40+ * edge between vertex i and vertex j with weight wt. There is at most
41+ * one edge between any two vertices; no vertex has an edge to itthis.
42+ * Vertices are identified by consecutive, non-negative integers.
43+ *
44+ * Return a list "mate", such that mate[i] === j if vertex i is
45+ * matched to vertex j, and mate[i] === -1 if vertex i is not matched.
46+ *
47+ * This function takes time O(n^3)
48+ *
49+ * @param {Array } edges
50+ * @param {Boolean } maxCardinality
51+ * @return {Array }
52+ */
53+
3454 const maxWeightMatching = function ( edges , maxCardinality = false ) {
3555 let i ;
3656 let j ;
@@ -39,23 +59,6 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
3959 let w ;
4060 let length ;
4161
42- /**
43- *
44- * Compute a maximum-weighted matching in the general undirected
45- * weighted graph given by "edges". If "maxCardinality" is true,
46- * only maximum-cardinality matchings are considered as solutions.
47- *
48- * Edges is a sequence of tuples (i, j, wt) describing an undirected
49- * edge between vertex i and vertex j with weight wt. There is at most
50- * one edge between any two vertices; no vertex has an edge to itthis.
51- * Vertices are identified by consecutive, non-negative integers.
52- *
53- * Return a list "mate", such that mate[i] === j if vertex i is
54- * matched to vertex j, and mate[i] === -1 if vertex i is not matched.
55- *
56- * This function takes time O(n ** 3){
57- */
58-
5962 //
6063 // Vertices are numbered 0 .. (nvertex-1).
6164 // Non-trivial blossoms are numbered nvertex .. (2*nvertex-1)
0 commit comments