ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
EulerianCycle.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*-------------------------- File EulerianCycle.h --------------------------*/
3/*--------------------------------------------------------------------------*/
53/*--------------------------------------------------------------------------*/
54/*----------------------------- DEFINITIONS --------------------------------*/
55/*--------------------------------------------------------------------------*/
56
57#ifndef __ADS_EulerianCycle
58 #define __ADS_EulerianCycle
59/* self-identification: #endif constant */
60
61/*--------------------------------------------------------------------------*/
62/*------------------------------ INCLUDES ----------------------------------*/
63/*--------------------------------------------------------------------------*/
64
65#include "ADS/Contract.h"
66#include "ADS/graph/Graph.h"
67
68#include <algorithm>
69#include <cstddef>
70#include <optional>
71#include <utility>
72#include <vector>
73
74/*--------------------------------------------------------------------------*/
75/*--------------------------- NAMESPACE ------------------------------------*/
76/*--------------------------------------------------------------------------*/
77
78namespace ADS
79{
80
104template< Graph G >
105std::optional< std::vector< int > > eulerianCycle( const G & g );
106
139template< Graph G >
140std::optional< std::vector< int > > eulerianTrail( const G & g );
141
160template< Graph G >
161std::optional< std::vector< int > > eulerianTrail( const G & g , int s );
162
175template< Graph G >
176bool isEulerianCycle( const G & g , const std::vector< int > & c );
177
196template< Graph G >
197bool isEulerianTrail( const G & g , const std::vector< int > & c );
198
199/*--------------------------------------------------------------------------*/
200
201} // end( namespace ADS )
202
203/*--------------------------------------------------------------------------*/
204/*-------------------------- IMPLEMENTATION --------------------------------*/
205/*--------------------------------------------------------------------------*/
206
207#include "ADS/graph/impl/EulerianCycle.tpp"
208
209/*--------------------------------------------------------------------------*/
210
211#endif /* EulerianCycle.h included */
212
213/*--------------------------------------------------------------------------*/
214/*------------------------ End File EulerianCycle.h ------------------------*/
215/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The GRAPH of chapter 9 and its realizations.
bool isEulerianCycle(const G &g, const std::vector< int > &c)
whether the nodes , the first repeated at the end, are a closed path that uses each edge of exactly ...
std::optional< std::vector< int > > eulerianCycle(const G &g)
the nodes of an Eulerian cycle of the graph, the first node repeated at the end, or nothing if there ...
std::optional< std::vector< int > > eulerianTrail(const G &g)
the nodes of an Eulerian trail of the graph, closed (the first node repeated at the end) if there is ...
bool isEulerianTrail(const G &g, const std::vector< int > &c)
whether the nodes are a path, open or closed, that uses each edge of exactly once,...
Definition ADT.h:96