
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
2SAT is a restricted version of the boolean satisfiability problem where the number of variables per clause is at most 2. Works both in node.js and in the browser using browserify.
var twoSat = require("2-sat")
//Solve problem:
//
// (x1 | !x2) & (x3 | x1) & (x3 | x2)
//
console.log(twoSat(3, [[1, -2], [3, 1], [3,2]]))
require("2-sat")(numVariables, clauses)
Finds a satisfying assignment for a 2SAT problem written in conjunctive normal form. If no assignment is possible returns false
.
numVariables
is the number of variablesclauses
is a list of binary clauses. Variables are indexed in clauses starting at 1
and negative values indicate negation.Returns A vector of assignments to the variables of the clause. If problem is not satisfiable, returns false
(c) 2013 Mikola Lysenko. MIT License
FAQs
2SAT solver
The npm package 2-sat receives a total of 7 weekly downloads. As such, 2-sat popularity was classified as not popular.
We found that 2-sat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.