Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fbeb3e8

Browse files
a-flying-potatomake-github-pseudonymous-again
authored andcommittedApr 15, 2021
🤖 chore: Lint source files.
These changes were automatically generated by a transform whose code can be found at: - https://github.com/aureooms/rejuvenate/blob/b20db05e5e78828d9a6224e5da5d23341866d340/src/transforms/sources:initial-lint.js Please contact the author of the transform if you believe there was an error.
1 parent 37234a1 commit fbeb3e8

29 files changed

+149
-154
lines changed
 

‎doc/scripts/header.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
var domReady = function(callback) {
2-
var state = document.readyState ;
3-
if ( state === 'interactive' || state === 'complete' ) {
4-
callback() ;
5-
}
6-
else {
1+
const domReady = function (callback) {
2+
const state = document.readyState;
3+
if (state === 'interactive' || state === 'complete') {
4+
callback();
5+
} else {
76
document.addEventListener('DOMContentLoaded', callback);
87
}
9-
} ;
10-
8+
};
119

12-
domReady(function(){
13-
14-
var projectname = document.createElement('a');
10+
domReady(() => {
11+
const projectname = document.createElement('a');
1512
projectname.classList.add('project-name');
1613
projectname.text = 'aureooms/js-maximum-matching';
17-
projectname.href = './index.html' ;
14+
projectname.href = './index.html';
1815

19-
var header = document.getElementsByTagName('header')[0] ;
20-
header.insertBefore(projectname,header.firstChild);
16+
const header = document.querySelectorAll('header')[0];
17+
header.insertBefore(projectname, header.firstChild);
2118

22-
var testlink = document.querySelector('header > a[data-ice="testLink"]') ;
23-
testlink.href = 'https://coveralls.io/github/aureooms/js-maximum-matching' ;
24-
testlink.target = '_BLANK' ;
19+
const testlink = document.querySelector('header > a[data-ice="testLink"]');
20+
testlink.href = 'https://coveralls.io/github/aureooms/js-maximum-matching';
21+
testlink.target = '_BLANK';
2522

26-
var searchBox = document.querySelector('.search-box');
27-
var input = document.querySelector('.search-input');
23+
const searchBox = document.querySelector('.search-box');
24+
const input = document.querySelector('.search-input');
2825

29-
// active search box when focus on searchBox.
30-
input.addEventListener('focus', function(){
26+
// Active search box when focus on searchBox.
27+
input.addEventListener('focus', () => {
3128
searchBox.classList.add('active');
3229
});
33-
3430
});

‎src/cardinality/approx/bipartite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import general from "./general.js";
1+
import general from './general.js';
22

33
export default general;

‎src/cardinality/approx/general.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import general from "../opt/general.js";
1+
import general from '../opt/general.js';
22

33
const generalApprox = (edges, _eps) => general(edges);
44
export default generalApprox;

‎src/cardinality/approx/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bipartite from "./bipartite.js";
2-
import general from "./general.js";
1+
import bipartite from './bipartite.js';
2+
import general from './general.js';
33

44
export default general;
55

‎src/cardinality/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import approx from "./approx/index.js";
2-
import opt from "./opt/index.js";
1+
import approx from './approx/index.js';
2+
import opt from './opt/index.js';
33

44
export default opt;
55

‎src/cardinality/opt/bipartite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import general from "./general.js";
1+
import general from './general.js';
22

33
export default general;

‎src/cardinality/opt/general.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import blossomNoChecks from "../../core/blossomNoChecks.js";
2-
import addDefaultWeight from "../../addDefaultWeight.js";
1+
import blossomNoChecks from '../../core/blossomNoChecks.js';
2+
import addDefaultWeight from '../../addDefaultWeight.js';
33

44
const general = (edges) => blossomNoChecks(addDefaultWeight(edges), true);
55

‎src/cardinality/opt/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bipartite from "./bipartite.js";
2-
import general from "./general.js";
1+
import bipartite from './bipartite.js';
2+
import general from './general.js';
33

44
export default general;
55

‎src/core/blossom/blossom.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import assert from 'assert';
2-
import min from "./min.js";
3-
import rotate from "./rotate.js";
4-
import verifyOptimum from "./verifyOptimum.js";
5-
import checkDelta2 from "./checkDelta2.js";
6-
import checkDelta3 from "./checkDelta3.js";
7-
import statistics from "./statistics.js";
8-
import endpoints from "./endpoints.js";
9-
import neighbours from "./neighbours.js";
10-
import blossomLeaves from "./blossomLeaves.js";
11-
import blossomEdges from "./blossomEdges.js";
2+
import min from './min.js';
3+
import rotate from './rotate.js';
4+
import verifyOptimum from './verifyOptimum.js';
5+
import checkDelta2 from './checkDelta2.js';
6+
import checkDelta3 from './checkDelta3.js';
7+
import statistics from './statistics.js';
8+
import endpoints from './endpoints.js';
9+
import neighbours from './neighbours.js';
10+
import blossomLeaves from './blossomLeaves.js';
11+
import blossomEdges from './blossomEdges.js';
1212

1313
// Adapted from http://jorisvr.nl/maximummatching.html
1414
// All credit for the implementation goes to Joris van Rantwijk [http://jorisvr.nl].
@@ -281,7 +281,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
281281
' w=' +
282282
w +
283283
') -> ' +
284-
b
284+
b,
285285
);
286286
blossombase[b] = base;
287287
blossomparent[b] = -1;
@@ -299,7 +299,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
299299
endps.push(labelend[bv]);
300300
assert(
301301
label[bv] === 2 ||
302-
(label[bv] === 1 && labelend[bv] === mate[blossombase[bv]])
302+
(label[bv] === 1 && labelend[bv] === mate[blossombase[bv]]),
303303
);
304304
// Trace one step back.
305305
assert(labelend[bv] >= 0);
@@ -320,7 +320,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
320320
endps.push(labelend[bw] ^ 1);
321321
assert(
322322
label[bw] === 2 ||
323-
(label[bw] === 1 && labelend[bw] === mate[blossombase[bw]])
323+
(label[bw] === 1 && labelend[bw] === mate[blossombase[bw]]),
324324
);
325325
// Trace one step back.
326326
assert(labelend[bw] >= 0);
@@ -404,7 +404,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
404404
// Expand the given top-level blossom.
405405
const expandBlossom = (b, endstage) => {
406406
console.debug(
407-
'DEBUG: expandBlossom(' + b + ',' + endstage + ') ' + blossomchilds[b]
407+
'DEBUG: expandBlossom(' + b + ',' + endstage + ') ' + blossomchilds[b],
408408
);
409409
// Convert sub-blossoms into top-level blossoms.
410410
for (let i = 0; i < blossomchilds[b].length; ++i) {
@@ -569,7 +569,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
569569
endpoint[p ^ 1] +
570570
' (k=' +
571571
Math.floor(p / 2) +
572-
')'
572+
')',
573573
);
574574
}
575575

@@ -588,7 +588,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
588588
const w = edges[k][1];
589589

590590
console.debug(
591-
'DEBUG: augmentMatching(' + k + ') (v=' + v + ' w=' + w + ')'
591+
'DEBUG: augmentMatching(' + k + ') (v=' + v + ' w=' + w + ')',
592592
);
593593
console.debug('DEBUG: PAIR ' + v + ' ' + w + ' (k=' + k + ')');
594594

@@ -631,7 +631,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
631631
// it will be assigned to mate[s] in the next step.
632632
p = labelend[bt] ^ 1;
633633
console.debug(
634-
'DEBUG: PAIR ' + s + ' ' + t + ' (k=' + Math.floor(p / 2) + ')'
634+
'DEBUG: PAIR ' + s + ' ' + t + ' (k=' + Math.floor(p / 2) + ')',
635635
);
636636
}
637637
};
@@ -684,7 +684,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
684684

685685
// Continue labeling until all vertices which are reachable
686686
// through an alternating path have got a label.
687-
while (queue.length && !augmented) {
687+
while (queue.length > 0 && !augmented) {
688688
// Take an S vertex from the queue.
689689
const v = queue.pop();
690690
console.debug('DEBUG: POP v=' + v);
@@ -746,13 +746,13 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
746746
const b = inblossom[v];
747747
if (bestedge[b] === -1 || kslack < slack(bestedge[b]))
748748
bestedge[b] = k;
749-
} else if (label[w] === 0) {
750-
// W is a free vertex (or an unreached vertex inside
749+
} else if (
750+
label[w] === 0 && // W is a free vertex (or an unreached vertex inside
751751
// a T-blossom) but we can not reach it yet;
752752
// keep track of the least-slack edge that reaches w.
753-
if (bestedge[w] === -1 || kslack < slack(bestedge[w]))
754-
bestedge[w] = k;
755-
}
753+
(bestedge[w] === -1 || kslack < slack(bestedge[w]))
754+
)
755+
bestedge[w] = k;
756756
}
757757
}
758758

@@ -776,7 +776,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
776776
endpoint,
777777
bestedge,
778778
slack,
779-
inblossom
779+
inblossom,
780780
});
781781
checkDelta3({
782782
nvertex,
@@ -788,7 +788,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
788788
endpoint,
789789
bestedge,
790790
slack,
791-
inblossom
791+
inblossom,
792792
});
793793
}
794794

@@ -877,7 +877,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
877877
deltatype === 1 ||
878878
deltatype === 2 ||
879879
deltatype === 3 ||
880-
deltatype === 4
880+
deltatype === 4,
881881
);
882882
if (deltatype === 1) {
883883
// No further improvement possible; optimum reached.
@@ -931,7 +931,7 @@ export default function blossom(CHECK_OPTIMUM, CHECK_DELTA) {
931931
endpoint,
932932
dualvar,
933933
blossombase,
934-
blossomendps
934+
blossomendps,
935935
});
936936

937937
// Transform mate[] such that mate[v] is the vertex to which v is paired.

‎src/core/blossom/blossomEdges.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import blossomLeaves from "./blossomLeaves.js";
1+
import blossomLeaves from './blossomLeaves.js';
22

33
export default function* blossomEdges(nvertex, blossomchilds, neighbend, bv) {
44
for (const v of blossomLeaves(nvertex, blossomchilds, bv)) {

‎src/core/blossom/blossomLeaves.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function* blossomLeaves(nvertex, nodes, b) {
77
}
88

99
function* _blossomLeavesDFS(nvertex, nodes, queue) {
10-
while (queue.length !== 0) {
10+
while (queue.length > 0) {
1111
const b = queue.pop();
1212
if (b < nvertex) yield b;
1313
else for (const t of nodes[b]) queue.push(t);

‎src/core/blossom/checkDelta2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const checkDelta2 = ({
88
endpoint,
99
bestedge,
1010
slack,
11-
inblossom
11+
inblossom,
1212
}) => {
1313
for (let v = 0; v < nvertex; ++v) {
1414
if (label[inblossom[v]] === 0) {
@@ -41,13 +41,13 @@ const checkDelta2 = ({
4141
' bestedge=' +
4242
bestedge[v] +
4343
' slack=' +
44-
slack(bestedge[v])
44+
slack(bestedge[v]),
4545
);
4646
}
4747

4848
assert(
4949
(bk === -1 && bestedge[v] === -1) ||
50-
(bestedge[v] !== -1 && bd === slack(bestedge[v]))
50+
(bestedge[v] !== -1 && bd === slack(bestedge[v])),
5151
);
5252
}
5353
}

‎src/core/blossom/checkDelta3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'assert';
2-
import blossomLeaves from "./blossomLeaves.js";
2+
import blossomLeaves from './blossomLeaves.js';
33

44
// Check optimized delta3 against a trivial computation.
55
const checkDelta3 = ({
@@ -12,7 +12,7 @@ const checkDelta3 = ({
1212
endpoint,
1313
bestedge,
1414
slack,
15-
inblossom
15+
inblossom,
1616
}) => {
1717
let bk = -1;
1818
let bd = null;

‎src/core/blossom/endpoints.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const endpoints = (nedge, edges) => {
22
const endpoint = [];
33
for (let p = 0; p < nedge; ++p) {
4-
endpoint.push(edges[p][0]);
5-
endpoint.push(edges[p][1]);
4+
endpoint.push(edges[p][0], edges[p][1]);
65
}
76

87
return endpoint;

‎src/core/blossom/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import blossom from "./blossom.js";
2-
import checkDelta2 from "./checkDelta2.js";
3-
import checkDelta3 from "./checkDelta3.js";
4-
import min from "./min.js";
5-
import rotate from "./rotate.js";
6-
import verifyOptimum from "./verifyOptimum.js";
1+
import blossom from './blossom.js';
2+
import checkDelta2 from './checkDelta2.js';
3+
import checkDelta3 from './checkDelta3.js';
4+
import min from './min.js';
5+
import rotate from './rotate.js';
6+
import verifyOptimum from './verifyOptimum.js';
77

88
export default blossom;
99

‎src/core/blossom/verifyOptimum.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'assert';
2-
import min from "./min.js";
2+
import min from './min.js';
33

44
// Verify that the optimum solution has been reached.
55
const verifyOptimum = ({
@@ -12,7 +12,7 @@ const verifyOptimum = ({
1212
endpoint,
1313
dualvar,
1414
blossombase,
15-
blossomendps
15+
blossomendps,
1616
}) => {
1717
let i;
1818
let j;

‎src/core/blossomNoChecks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import blossom from "./blossom/index.js";
1+
import blossom from './blossom/index.js';
22

33
const blossomNoChecks = blossom(false, false);
44

‎src/core/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import blossom from "./blossom/index.js";
2-
import blossomNoChecks from "./blossomNoChecks.js";
1+
import blossom from './blossom/index.js';
2+
import blossomNoChecks from './blossomNoChecks.js';
33

44
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
55
export default {
66
blossom,
7-
blossomNoChecks
7+
blossomNoChecks,
88
};
99

1010
export {blossom, blossomNoChecks};

‎src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import cardinality from "./cardinality/index.js";
2-
import core from "./core/index.js";
3-
import weight from "./weight/index.js";
4-
import iter from "./iter.js";
5-
import addDefaultWeight from "./addDefaultWeight.js";
1+
import cardinality from './cardinality/index.js';
2+
import core from './core/index.js';
3+
import weight from './weight/index.js';
4+
import iter from './iter.js';
5+
import addDefaultWeight from './addDefaultWeight.js';
66

77
export default weight;
88

‎src/weight/approx/bipartite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import general from "./general.js";
1+
import general from './general.js';
22

33
export default general;

‎src/weight/approx/general.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import general from "../opt/general.js";
1+
import general from '../opt/general.js';
22

33
const generalApprox = (edges, _eps) => general(edges);
44
export default generalApprox;

‎src/weight/approx/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bipartite from "./bipartite.js";
2-
import general from "./general.js";
1+
import bipartite from './bipartite.js';
2+
import general from './general.js';
33

44
export default general;
55

‎src/weight/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import approx from "./approx/index.js";
2-
import opt from "./opt/index.js";
1+
import approx from './approx/index.js';
2+
import opt from './opt/index.js';
33

44
export default opt;
55

‎src/weight/opt/bipartite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import general from "./general.js";
1+
import general from './general.js';
22

33
export default general;

‎src/weight/opt/general.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import blossomNoChecks from "../../core/blossomNoChecks.js";
1+
import blossomNoChecks from '../../core/blossomNoChecks.js';
22

33
const general = (edges) => blossomNoChecks(edges);
44

‎src/weight/opt/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bipartite from "./bipartite.js";
2-
import general from "./general.js";
1+
import bipartite from './bipartite.js';
2+
import general from './general.js';
33

44
export default general;
55

‎test/src/cardinality.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import test from 'ava';
22
import {enumerate} from '@aureooms/js-itertools';
33

4-
import maximumCardinalityMatching from "../../src/cardinality/index.js";
5-
import {addDefaultWeight} from "../../src/index.js";
6-
import blossom from "../../src/core/blossom/index.js";
4+
import maximumCardinalityMatching from '../../src/cardinality/index.js';
5+
import {addDefaultWeight} from '../../src/index.js';
6+
import blossom from '../../src/core/blossom/index.js';
77

88
const macro = (t, algorithm, edges, expected) => {
99
const input = edges.map((edge) => edge.slice()); // Deepcopy
@@ -21,18 +21,18 @@ const tests = {
2121
edges: [
2222
[1, 2],
2323
[2, 3],
24-
[3, 4]
24+
[3, 4],
2525
],
26-
expected: [-1, 2, 1, 4, 3]
26+
expected: [-1, 2, 1, 4, 3],
2727
},
2828

2929
test14_maxcard: {
3030
edges: [
3131
[1, 2, 5],
3232
[2, 3, 11],
33-
[3, 4, 5]
33+
[3, 4, 5],
3434
],
35-
expected: [-1, 2, 1, 4, 3]
35+
expected: [-1, 2, 1, 4, 3],
3636
},
3737

3838
test16_negative_maxCardinality: {
@@ -41,10 +41,10 @@ const tests = {
4141
[1, 3, -2],
4242
[2, 3, 1],
4343
[2, 4, -1],
44-
[3, 4, -6]
44+
[3, 4, -6],
4545
],
46-
expected: [-1, 3, 4, 1, 2]
47-
}
46+
expected: [-1, 3, 4, 1, 2],
47+
},
4848
};
4949

5050
const btt = blossom(true, true);
@@ -53,7 +53,7 @@ const bdflt = blossom();
5353
const algorithms = [
5454
maximumCardinalityMatching,
5555
(edges) => btt(addDefaultWeight(edges), true),
56-
(edges) => bdflt(addDefaultWeight(edges), true)
56+
(edges) => bdflt(addDefaultWeight(edges), true),
5757
];
5858

5959
for (const [i, algorithm] of enumerate(algorithms))

‎test/src/readme.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import test from 'ava';
22

3-
import maximumMatching, {iter} from "../../src/index.js";
4-
import maximumCardinalityMatching from "../../src/cardinality/index.js";
3+
import maximumMatching, {iter} from '../../src/index.js';
4+
import maximumCardinalityMatching from '../../src/cardinality/index.js';
55

66
test('weight', (t) => {
77
const edges = [
88
[1, 2, 10],
9-
[2, 3, 11]
9+
[2, 3, 11],
1010
];
1111
const matching = maximumMatching(edges); // [-1, -1, 3, 2]
1212
t.deepEqual(matching, [-1, -1, 3, 2]);
@@ -17,11 +17,11 @@ test('cardinality', (t) => {
1717
const edges = [
1818
[1, 2],
1919
[2, 3],
20-
[3, 4]
20+
[3, 4],
2121
];
2222
const result = [...iter(maximumCardinalityMatching(edges))];
2323
t.deepEqual(result, [
2424
[1, 2],
25-
[3, 4]
25+
[3, 4],
2626
]);
2727
});

‎test/src/weight.js

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import test from 'ava';
22
import {enumerate} from '@aureooms/js-itertools';
33

4-
import maximumMatching from "../../src/index.js";
5-
import blossom from "../../src/core/blossom/index.js";
4+
import maximumMatching from '../../src/index.js';
5+
import blossom from '../../src/core/blossom/index.js';
66

77
const macro = (t, algorithm, edges, expected) => {
88
const input = edges.map((edge) => edge.slice()); // Deepcopy
@@ -25,18 +25,18 @@ const tests = {
2525
test12: {
2626
edges: [
2727
[1, 2, 10],
28-
[2, 3, 11]
28+
[2, 3, 11],
2929
],
30-
expected: [-1, -1, 3, 2]
30+
expected: [-1, -1, 3, 2],
3131
},
3232

3333
test13: {
3434
edges: [
3535
[1, 2, 5],
3636
[2, 3, 11],
37-
[3, 4, 5]
37+
[3, 4, 5],
3838
],
39-
expected: [-1, -1, 3, 2, -1]
39+
expected: [-1, -1, 3, 2, -1],
4040
},
4141

4242
// Floating point weigths
@@ -45,9 +45,9 @@ const tests = {
4545
[1, 2, Math.PI],
4646
[2, 3, Math.E],
4747
[1, 3, 3],
48-
[1, 4, Math.sqrt(2)]
48+
[1, 4, Math.sqrt(2)],
4949
],
50-
expected: [-1, 4, 3, 2, 1]
50+
expected: [-1, 4, 3, 2, 1],
5151
},
5252

5353
// Negative weights
@@ -57,9 +57,9 @@ const tests = {
5757
[1, 3, -2],
5858
[2, 3, 1],
5959
[2, 4, -1],
60-
[3, 4, -6]
60+
[3, 4, -6],
6161
],
62-
expected: [-1, 2, 1, -1, -1]
62+
expected: [-1, 2, 1, -1, -1],
6363
},
6464

6565
// Create S-blossom and use it for augmentation
@@ -68,9 +68,9 @@ const tests = {
6868
[1, 2, 8],
6969
[1, 3, 9],
7070
[2, 3, 10],
71-
[3, 4, 7]
71+
[3, 4, 7],
7272
],
73-
expected: [-1, 2, 1, 4, 3]
73+
expected: [-1, 2, 1, 4, 3],
7474
},
7575
test20_sblossom_2: {
7676
edges: [
@@ -79,9 +79,9 @@ const tests = {
7979
[2, 3, 10],
8080
[3, 4, 7],
8181
[1, 6, 5],
82-
[4, 5, 6]
82+
[4, 5, 6],
8383
],
84-
expected: [-1, 6, 3, 2, 5, 4, 1]
84+
expected: [-1, 6, 3, 2, 5, 4, 1],
8585
},
8686

8787
// Create S-blossom, relabel as T-blossom, use for augmentation
@@ -92,9 +92,9 @@ const tests = {
9292
[2, 3, 10],
9393
[1, 4, 5],
9494
[4, 5, 4],
95-
[1, 6, 3]
95+
[1, 6, 3],
9696
],
97-
expected: [-1, 6, 3, 2, 5, 4, 1]
97+
expected: [-1, 6, 3, 2, 5, 4, 1],
9898
},
9999
test21_tblossom_2: {
100100
edges: [
@@ -103,9 +103,9 @@ const tests = {
103103
[2, 3, 10],
104104
[1, 4, 5],
105105
[4, 5, 3],
106-
[1, 6, 4]
106+
[1, 6, 4],
107107
],
108-
expected: [-1, 6, 3, 2, 5, 4, 1]
108+
expected: [-1, 6, 3, 2, 5, 4, 1],
109109
},
110110
test21_tblossom_3: {
111111
edges: [
@@ -114,9 +114,9 @@ const tests = {
114114
[2, 3, 10],
115115
[1, 4, 5],
116116
[4, 5, 3],
117-
[3, 6, 4]
117+
[3, 6, 4],
118118
],
119-
expected: [-1, 2, 1, 6, 5, 4, 3]
119+
expected: [-1, 2, 1, 6, 5, 4, 3],
120120
},
121121

122122
// Create nested S-blossom, use for augmentation
@@ -128,9 +128,9 @@ const tests = {
128128
[2, 4, 8],
129129
[3, 5, 8],
130130
[4, 5, 10],
131-
[5, 6, 6]
131+
[5, 6, 6],
132132
],
133-
expected: [-1, 3, 4, 1, 2, 6, 5]
133+
expected: [-1, 3, 4, 1, 2, 6, 5],
134134
},
135135

136136
// Create S-blossom, relabel as S, include in nested S-blossom
@@ -144,9 +144,9 @@ const tests = {
144144
[4, 5, 25],
145145
[5, 6, 10],
146146
[6, 7, 10],
147-
[7, 8, 8]
147+
[7, 8, 8],
148148
],
149-
expected: [-1, 2, 1, 4, 3, 6, 5, 8, 7]
149+
expected: [-1, 2, 1, 4, 3, 6, 5, 8, 7],
150150
},
151151

152152
// Create nested S-blossom, augment, expand recursively
@@ -161,9 +161,9 @@ const tests = {
161161
[4, 6, 12],
162162
[5, 7, 12],
163163
[6, 7, 14],
164-
[7, 8, 12]
164+
[7, 8, 12],
165165
],
166-
expected: [-1, 2, 1, 5, 6, 3, 4, 8, 7]
166+
expected: [-1, 2, 1, 5, 6, 3, 4, 8, 7],
167167
},
168168

169169
// Create S-blossom, relabel as T, expand
@@ -176,9 +176,9 @@ const tests = {
176176
[3, 4, 22],
177177
[4, 5, 25],
178178
[4, 8, 14],
179-
[5, 7, 13]
179+
[5, 7, 13],
180180
],
181-
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4]
181+
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4],
182182
},
183183

184184
// Create nested S-blossom, relabel as T, expand
@@ -192,9 +192,9 @@ const tests = {
192192
[3, 5, 18],
193193
[4, 5, 13],
194194
[4, 7, 7],
195-
[5, 6, 7]
195+
[5, 6, 7],
196196
],
197-
expected: [-1, 8, 3, 2, 7, 6, 5, 4, 1]
197+
expected: [-1, 8, 3, 2, 7, 6, 5, 4, 1],
198198
},
199199

200200
// Create blossom, relabel as T in more than one way, expand, augment
@@ -209,9 +209,9 @@ const tests = {
209209
[3, 9, 35],
210210
[4, 8, 35],
211211
[5, 7, 26],
212-
[9, 10, 5]
212+
[9, 10, 5],
213213
],
214-
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4, 10, 9]
214+
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4, 10, 9],
215215
},
216216

217217
// Again but slightly different
@@ -226,9 +226,9 @@ const tests = {
226226
[3, 9, 35],
227227
[4, 8, 26],
228228
[5, 7, 40],
229-
[9, 10, 5]
229+
[9, 10, 5],
230230
],
231-
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4, 10, 9]
231+
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4, 10, 9],
232232
},
233233

234234
// Create blossom, relabel as T, expand such that a new least-slack S-to-free edge is produced, augment
@@ -243,9 +243,9 @@ const tests = {
243243
[3, 9, 35],
244244
[4, 8, 28],
245245
[5, 7, 26],
246-
[9, 10, 5]
246+
[9, 10, 5],
247247
],
248-
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4, 10, 9]
248+
expected: [-1, 6, 3, 2, 8, 7, 1, 5, 4, 10, 9],
249249
},
250250

251251
// Create nested blossom, relabel as T in more than one way, expand outer blossom such that inner blossom ends up on an augmenting path
@@ -263,9 +263,9 @@ const tests = {
263263
[3, 11, 35],
264264
[5, 9, 36],
265265
[7, 10, 26],
266-
[11, 12, 5]
266+
[11, 12, 5],
267267
],
268-
expected: [-1, 8, 3, 2, 6, 9, 4, 10, 1, 5, 7, 12, 11]
268+
expected: [-1, 8, 3, 2, 6, 9, 4, 10, 1, 5, 7, 12, 11],
269269
},
270270

271271
// Create nested S-blossom, relabel as S, expand recursively
@@ -281,10 +281,10 @@ const tests = {
281281
[5, 7, 30],
282282
[7, 6, 10],
283283
[8, 10, 10],
284-
[4, 9, 30]
284+
[4, 9, 30],
285285
],
286-
expected: [-1, 2, 1, 5, 9, 3, 7, 6, 10, 4, 8]
287-
}
286+
expected: [-1, 2, 1, 5, 9, 3, 7, 6, 10, 4, 8],
287+
},
288288
};
289289

290290
const btt = blossom(true, true);
@@ -293,7 +293,7 @@ const bdflt = blossom();
293293
const algorithms = [
294294
maximumMatching,
295295
(edges) => btt(edges),
296-
(edges) => bdflt(edges)
296+
(edges) => bdflt(edges),
297297
];
298298

299299
for (const [i, algorithm] of enumerate(algorithms))

0 commit comments

Comments
 (0)
Please sign in to comment.