-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
1 lines (1 loc) · 938 Bytes
/
index.js
1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BronKerbosch=t()}(this,(function(){"use strict";function e(e,t){let n=new Set;return t.forEach((t=>{e.has(t)&&n.add(t)})),n}return function(t){t=Array.from(t);let n=new Set;if(t.forEach((e=>{n.add(e[0]).add(e[1])})),n.size<2)return[];let r=new Map;n.forEach((e=>{r.set(e,new Set)})),t.forEach((e=>{r.get(e[0]).add(e[1]),r.get(e[1]).add(e[0])}));let o=[],d=(t,n,f)=>{n.size||f.size||o.push(Array.from(t));let a=new Set;(function(e,t){let n=new Set(e);return t.forEach((e=>{n.add(e)})),n})(n,f).forEach((t=>{let o=e(r.get(t),n);o.size>a.size&&(a=o)})),function(e,t){let n=new Set(e);return t.forEach((e=>{n.delete(e)})),n}(n,a).forEach((o=>{let a=r.get(o);d(new Set(t).add(o),e(n,a),e(f,a)),n.delete(o),f.add(o)}))};return d(new Set,n,new Set),o}}));