Skip to content

Commit 40b1874

Browse files
simplify
1 parent 87b5edf commit 40b1874

File tree

6 files changed

+26
-38
lines changed

6 files changed

+26
-38
lines changed

lib/maxback/_smallcuts.js

+13-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/maxback/maxback.js

+6-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/maxback/mb.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/maxback/_smallcuts.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ export default function* _smallcuts ( G ) {
1212
while ( H.size >= 2 ) {
1313

1414
const ordering = list(_order(H));
15-
const x = ordering[ordering.length-2][0];
16-
const y = ordering[ordering.length-1][0];
15+
const [ x ] = ordering[ordering.length-2];
16+
const [ y , cutsize ] = ordering[ordering.length-1];
1717

18-
const U = new Set(chain(map( ([u,_]) => id.get(u) , head(ordering,-1) ) ));
19-
const V = new Set(id.get(y));
20-
21-
yield { 'partition' : [ U , V ] , 'size' : ordering[ordering.length-1][1] } ;
18+
yield [ new Set(id.get(y)) , cutsize ] ;
2219

2320
id.set(x, id.get(x).concat(id.get(y)));
2421

src/maxback/maxback.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import outgoingedges from '../outgoingedges';
1010
*/
1111
export default function maxback ( edges ) {
1212
const G = adj( edges ) ;
13-
const { partition : [ U , _ ] } = mb( G ) ;
13+
const [ U ] = mb( G ) ;
1414
return outgoingedges( G , U ) ;
1515
}

src/maxback/mb.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { attr , increasing } from '@aureooms/js-compare' ;
44
import _smallcuts from './_smallcuts' ;
55

66
export default function mb ( G ) {
7-
return min( attr( increasing , 'size' ) , _smallcuts(G) , undefined ) ;
7+
return min( attr( increasing , 1 ) , _smallcuts(G) , undefined ) ;
88
}

0 commit comments

Comments
 (0)