nxpp
Header-only graph utilities on top of Boost Graph Library
Loading...
Searching...
No Matches
sat.hpp File Reference

2-SAT helper utilities built on top of the graph wrapper. More...

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/strong_components.hpp>
#include <utility>
#include <vector>
Include dependency graph for sat.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int nxpp::to_2sat_vertex_id (int literal)
 Converts a signed 2-SAT literal into the internal implication-graph vertex ID.
 
bool nxpp::two_sat_satisfiable (int num_variables, const std::vector< std::pair< int, int > > &clauses)
 Returns whether a 2-SAT instance is satisfiable.
 

Detailed Description

2-SAT helper utilities built on top of the graph wrapper.

Function Documentation

◆ two_sat_satisfiable()

bool nxpp::two_sat_satisfiable ( int  num_variables,
const std::vector< std::pair< int, int > > &  clauses 
)
inline

Returns whether a 2-SAT instance is satisfiable.

Parameters
num_variablesNumber of Boolean variables in the instance.
clausesVector of (x, y) clauses representing (x OR y).

References nxpp::to_2sat_vertex_id(), and nxpp::two_sat_satisfiable().

Referenced by nxpp::two_sat_satisfiable().