UNPKG
@aureooms/js-2sat
Version:
latest (0.0.3)
0.0.3
2-Satisfiability code bricks for JavaScript
aureooms.github.io/js-2sat/
aureooms/js-2sat
@aureooms/js-2sat
/
src
/
decide.js
16 lines
(7 loc)
•
254 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export
function
decide
(
formula , G
) {
for
(
let
[ a , b ]
of
formula ) G.
add_edges
( [ -a , b ] , [ -b , a ] ) ;
for
(
let
H
of
G.
strongly_connected_components
( ) ) {
for
(
let
a
of
H )
if
( H.
has
( -a ) )
return
false
; }
return
true
; }