ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
EasyCases.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File EasyCases.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
48/*--------------------------------------------------------------------------*/
49/*----------------------------- DEFINITIONS --------------------------------*/
50/*--------------------------------------------------------------------------*/
51
52#ifndef __ADS_EasyCases
53 #define __ADS_EasyCases
54/* self-identification: #endif constant */
55
56/*--------------------------------------------------------------------------*/
57/*------------------------------ INCLUDES ----------------------------------*/
58/*--------------------------------------------------------------------------*/
59
60#include "ADS/Contract.h"
62#include "ADS/graph/ListGraph.h"
63#include "ADS/graph/MaxFlow.h"
64#include "ADS/graph/Visit.h"
66
67#include <algorithm>
68#include <cstdlib>
69#include <optional>
70#include <set>
71#include <utility>
72#include <vector>
73
74/*--------------------------------------------------------------------------*/
75/*--------------------------- NAMESPACE ------------------------------------*/
76/*--------------------------------------------------------------------------*/
77
78namespace ADS
79{
80
85inline int literalNode( int l );
86
111inline std::optional< std::vector< bool > > twoSat( const Cnf & F , int n );
112
140inline std::optional< std::vector< int > > twoColoring( const Adjacency & G );
141
165inline std::vector< std::pair< int , int > >
166bipartiteMatching( int p , int q ,
167 const std::vector< std::pair< int , int > > & E );
168
184inline Adjacency
185intervalGraph( const std::vector< std::pair< long , long > > & I );
186
208inline int intervalClique( const std::vector< std::pair< long , long > > & I );
209
210/*--------------------------------------------------------------------------*/
211
212} // end( namespace ADS )
213
214/*--------------------------------------------------------------------------*/
215/*-------------------------- IMPLEMENTATION --------------------------------*/
216/*--------------------------------------------------------------------------*/
217
218#include "ADS/complexity/impl/EasyCases.tpp"
219
220/*--------------------------------------------------------------------------*/
221
222#endif /* EasyCases.h included */
223
224/*--------------------------------------------------------------------------*/
225/*-------------------------- End File EasyCases.h --------------------------*/
226/*--------------------------------------------------------------------------*/
The QUEUE of the book [see ADT.h] realized with a circular vector of places, the place 0 following t...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The GRAPH with lists of adjacency of section 9.4 [see Graph.h]: for each node the LIST of its adjacen...
The maximum flow of section 15.2 in a network , with integer capacities, and the minimum cut.
The problems in NP of chapter 18, each with its polynomial certificate, which checks a proposed solut...
The visits of a GRAPH of section 9.5 and their applications, each in time on lists or vectors of adj...
std::optional< std::vector< bool > > twoSat(const Cnf &F, int n)
an assignment of the variables that satisfies , each clause of one or two literals,...
std::vector< std::pair< int, int > > bipartiteMatching(int p, int q, const std::vector< std::pair< int, int > > &E)
the pairs of a largest matching of the bipartite graph with left and right nodes and the edges of...
int literalNode(int l)
the node of the literal in the graph of the implications, for and for its negation
int intervalClique(const std::vector< std::pair< long, long > > &I)
the largest clique of the graph of the intervals : the most intervals through one point,...
Adjacency intervalGraph(const std::vector< std::pair< long, long > > &I)
the graph of the intervals , an edge if two share a point: an empty interval meets none,...
std::optional< std::vector< int > > twoColoring(const Adjacency &G)
the side, 0 or 1, of each node of , the ends of each edge apart, or nothing if has an odd cycle; the...
Definition ADT.h:96
std::vector< Clause > Cnf
a formula
Definition Problems.h:85
std::vector< std::vector< bool > > Adjacency
an adjacency
Definition Problems.h:83