almete.bronkerbosch
Advanced tools
Comparing version 17.8.19 to 17.9.10
(function(factory) { | ||
if (typeof module !== 'undefined' && typeof exports !== 'undefined' && this === exports) { | ||
factory(module); | ||
module.exports = factory(); | ||
} else { | ||
let module = {}; | ||
factory(module); | ||
(this.almete = this.almete || {}).BronKerbosch = module.exports; | ||
(this.almete = this.almete || {}).BronKerbosch = factory(); | ||
} | ||
}).call(this, function(module) { | ||
}).call(this, function() { | ||
@@ -79,4 +77,4 @@ let _union = function(set, otherSet) { | ||
module.exports = BronKerbosch; | ||
return BronKerbosch; | ||
}); |
@@ -1,1 +0,1 @@ | ||
(function(a){if('undefined'!=typeof module&&'undefined'!=typeof exports&&this===exports)a(module);else{let b={};a(b),(this.almete=this.almete||{}).BronKerbosch=b.exports}}).call(this,function(a){let b=function(g,h){return new Set(function*(){yield*g,yield*h}())},c=function(g,h){let i=new Set;for(let j of g)h.has(j)&&i.add(j);return i},d=function(g,h){let i=new Set;for(let j of g)h.has(j)||i.add(j);return i};a.exports=function(g){let h=new Set;for(let k of g)h.add(k[0]).add(k[1]);if(2>h.size)return[];let i=new Map;for(let k of h)i.set(k,new Set);for(let k of g)i.get(k[0]).add(k[1]),i.get(k[1]).add(k[0]);let j=[];return function k(l,m,n){1>m.size&&1>n.size&&j.push([...l]);let o=new Set;for(let p of b(m,n)){let q=c(i.get(p),m);q.size>o.size&&(o=q)}for(let p of d(m,o)){let q=i.get(p);k(new Set(l).add(p),c(m,q),c(n,q)),m.delete(p),n.add(p)}}(new Set,h,new Set),j}}); | ||
(function(a){'undefined'!=typeof module&&'undefined'!=typeof exports&&this===exports?module.exports=a():(this.almete=this.almete||{}).BronKerbosch=a()}).call(this,function(){let a=function(e,g){return new Set(function*(){yield*e,yield*g}())},b=function(e,g){let h=new Set;for(let i of e)g.has(i)&&h.add(i);return h},c=function(e,g){let h=new Set;for(let i of e)g.has(i)||h.add(i);return h};return function(e){let g=new Set;for(let j of e)g.add(j[0]).add(j[1]);if(2>g.size)return[];let h=new Map;for(let j of g)h.set(j,new Set);for(let j of e)h.get(j[0]).add(j[1]),h.get(j[1]).add(j[0]);let i=[];return function j(k,l,m){1>l.size&&1>m.size&&i.push([...k]);let n=new Set;for(let o of a(l,m)){let p=b(h.get(o),l);p.size>n.size&&(n=p)}for(let o of c(l,n)){let p=h.get(o);j(new Set(k).add(o),b(l,p),b(m,p)),l.delete(o),m.add(o)}}(new Set,g,new Set),i}}); |
{ | ||
"name": "almete.bronkerbosch", | ||
"version": "17.8.19", | ||
"version": "17.9.10", | ||
"description": "Implementation of Bron-Kerbosch algorithm to find maximal cliques in an undirected graph.", | ||
@@ -5,0 +5,0 @@ "main": "almete.BronKerbosch.js", |
5801
69