|
ADS
Algorithms and Data Structures
|
The polynomial halves of the pairs of table 19.1 of the conclusion, problems close to NP-hard ones but solvable in polynomial time, and the special cases that the conclusion names, the interval graphs: More...
#include "ADS/Contract.h"#include "ADS/complexity/Problems.h"#include "ADS/graph/ListGraph.h"#include "ADS/graph/MaxFlow.h"#include "ADS/graph/Visit.h"#include "ADS/queue/ArrayQueue.h"#include <algorithm>#include <cstdlib>#include <optional>#include <set>#include <utility>#include <vector>#include "ADS/complexity/impl/EasyCases.tpp"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| int | ADS::literalNode (int l) |
| the node of the literal \( \pm( v + 1 ) \) in the graph of the implications, \( 2 v \) for \( v \) and \( 2 v + 1 \) for its negation | |
| std::optional< std::vector< bool > > | ADS::twoSat (const Cnf &F, int n) |
| an assignment of the \( n \) variables that satisfies \( F \), each clause of one or two literals, or nothing | |
| std::optional< std::vector< int > > | ADS::twoColoring (const Adjacency &G) |
| the side, 0 or 1, of each node of \( G \), the ends of each edge apart, or nothing if \( G \) has an odd cycle; the diagonal of \( G \) is ignored, as by coloring() [see Problems.h] | |
| std::vector< std::pair< int, int > > | ADS::bipartiteMatching (int p, int q, const std::vector< std::pair< int, int > > &E) |
| the pairs \( ( i , j ) \) of a largest matching of the bipartite graph with \( p \) left and \( q \) right nodes and the edges \( ( i , j ) \) of \( E \), by a maximum flow | |
| Adjacency | ADS::intervalGraph (const std::vector< std::pair< long, long > > &I) |
| the graph of the intervals \( [ a , b ) \), an edge if two share a point: an empty interval \( [ a , a ) \) meets none, as in intervalClique() | |
| int | ADS::intervalClique (const std::vector< std::pair< long, long > > &I) |
| the largest clique of the graph of the intervals \( [ a , b ) \): the most intervals through one point, the right ends before the left ones | |
The polynomial halves of the pairs of table 19.1 of the conclusion, problems close to NP-hard ones but solvable in polynomial time, and the special cases that the conclusion names, the interval graphs:
The contracts [see Contract.h]: the inputs are instances of the polynomial problems (clauses of at most two literals, unoriented graphs, intervals with \( a \le b \)) and each solution returned is checked as a postcondition. The operations are defined in EasyCases.tpp.