ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Properties.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*--------------------------- File Properties.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
105/*--------------------------------------------------------------------------*/
106/*----------------------------- DEFINITIONS --------------------------------*/
107/*--------------------------------------------------------------------------*/
108
109#ifndef __ADS_Properties
110 #define __ADS_Properties
111/* self-identification: #endif constant */
112
113/*--------------------------------------------------------------------------*/
114/*------------------------------ INCLUDES ----------------------------------*/
115/*--------------------------------------------------------------------------*/
116
117#include "ADS/Contract.h"
118#include "ADS/graph/Graph.h"
119#include "ADS/graph/Visit.h"
120#include "ADS/tree/BinaryTree.h"
121
122#include <algorithm>
123#include <cstddef>
124#include <cstdint>
125#include <optional>
126#include <utility>
127#include <vector>
128
129/*--------------------------------------------------------------------------*/
130/*--------------------------- NAMESPACE ------------------------------------*/
131/*--------------------------------------------------------------------------*/
132
133namespace ADS
134{
135
136/*--------------------------------------------------------------------------*/
137/*--------------------------------- TREES ----------------------------------*/
138/*--------------------------------------------------------------------------*/
139
152template< Graph G >
153bool isTree( const G & g );
154
168template< Graph G >
169int diameter( const G & g );
170
183template< Graph G >
184int treeDiameter( const G & g );
185
201template< class T >
202std::pair< int , int > treeDiameter( const BinaryTree< T > * t );
203
224template< Graph G >
225std::vector< int > treeVertexCover( const G & g );
226
227/*--------------------------------------------------------------------------*/
228/*------------------------------- STRUCTURE --------------------------------*/
229/*--------------------------------------------------------------------------*/
230
253template< Graph G >
254std::int64_t countTriangles( const G & g );
255
281template< Graph G >
282std::optional< std::vector< int > > twoColoring( const G & g );
283
303template< class T >
304int universalSink( const std::vector< std::vector< T > > & A );
305
312template< Graph G >
313 requires requires( const G g , int u , int v )
314{
315 { g.hasEdge( u , v ) } -> std::convertible_to< bool >;
316 }
317int universalSink( const G & g );
318
343template< Graph G >
344std::optional< std::vector< int > > uniqueTopologicalOrder( const G & g );
345
346/*--------------------------------------------------------------------------*/
347
348} // end( namespace ADS )
349
350/*--------------------------------------------------------------------------*/
351/*-------------------------- IMPLEMENTATION --------------------------------*/
352/*--------------------------------------------------------------------------*/
353
354#include "ADS/graph/impl/Properties.tpp"
355
356/*--------------------------------------------------------------------------*/
357
358#endif /* Properties.h included */
359
360/*--------------------------------------------------------------------------*/
361/*------------------------- End File Properties.h --------------------------*/
362/*--------------------------------------------------------------------------*/
The binary TREE of the book: an ordered tree where each node has at most two children,...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The visits of a GRAPH of section 9.5 and their applications, each in time on lists or vectors of adj...
a binary tree with pointers to the parent and to the two children
Definition BinaryTree.h:104
The GRAPH of chapter 9 and its realizations.
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...
std::vector< int > treeVertexCover(const G &g)
the nodes of a minimum vertex cover of the forest, in increasing order
std::int64_t countTriangles(const G &g)
the triangles of the unoriented graph
int diameter(const G &g)
the largest distance in edges between two nodes
int universalSink(const std::vector< std::vector< T > > &A)
the node with an edge from every other one and no edge out, NIL if there is none, from the matrix of ...
int treeDiameter(const G &g)
the edges of a longest path of the free tree
bool isTree(const G &g)
whether the unoriented graph is a free tree, connected and with edges
std::optional< std::vector< int > > uniqueTopologicalOrder(const G &g)
the topological order of the oriented graph if it is the only one, nothing if it has a cycle or more ...
Definition ADT.h:96