Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flex-algo

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-algo - npm Package Compare versions

Comparing version 0.1.56 to 0.1.57

1

lib/graph.d.ts

@@ -17,3 +17,4 @@ declare class Graph {

indegrees(): number[];
bipartition(): boolean;
}
export { Graph };

@@ -11,2 +11,3 @@ "use strict";

Graph.prototype.create = function (vectors, nodes) {
this._nodes = nodes;
this._adjList = new Array(nodes).fill(0).map(function () { return []; });

@@ -126,4 +127,28 @@ for (var i = 0; i < vectors.length; i++) {

};
Graph.prototype.bipartition = function () {
var _a;
var group = new Array(this._nodes + 1).fill(0);
for (var i = 1; i <= this._nodes; i++) {
if (group[i] === 0) {
group[i] = 1;
var queue = [i];
while (queue.length) {
var node = queue.shift();
for (var j = 0; j < ((_a = this._adjList[node]) === null || _a === void 0 ? void 0 : _a.length); j++) {
var neighbor = this._adjList[node][j];
if (group[node] === group[neighbor]) {
return false;
}
if (group[neighbor] === 0) {
group[neighbor] = -1 * group[node];
queue.push(neighbor);
}
}
}
}
}
return true;
};
return Graph;
}());
exports.Graph = Graph;

2

package.json
{
"name": "flex-algo",
"version": "0.1.56",
"version": "0.1.57",
"description": "\"SDK for commonly used data structure and algorithms\"",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc