ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
BlossomMatching.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------- File BlossomMatching.h -------------------------*/
3/*--------------------------------------------------------------------------*/
79/*--------------------------------------------------------------------------*/
80/*----------------------------- DEFINITIONS --------------------------------*/
81/*--------------------------------------------------------------------------*/
82
83#ifndef __ADS_BlossomMatching
84 #define __ADS_BlossomMatching
85/* self-identification: #endif constant */
86
87/*--------------------------------------------------------------------------*/
88/*------------------------------ INCLUDES ----------------------------------*/
89/*--------------------------------------------------------------------------*/
90
91#include "ADS/Contract.h"
92#include "ADS/graph/Graph.h"
93#include "ADS/graph/Matching.h"
94#include "ADS/graph/Visit.h"
95
96#include <algorithm>
97#include <cstddef>
98#include <tuple>
99#include <type_traits>
100#include <utility>
101#include <vector>
102
103// the solves from scratch on the matchings of LEMON with ADS_WITH_LEMON,
104// unless ADS_MATCHING_LEMON is 0 (the benchmarks keep the code of ADS)
105#if defined( ADS_WITH_LEMON ) && ! defined( ADS_MATCHING_LEMON )
106 #define ADS_MATCHING_LEMON 1
107#endif
108#if defined( ADS_MATCHING_LEMON ) && ADS_MATCHING_LEMON
109 #include <lemon/matching.h>
110 #include <lemon/smart_graph.h>
111#endif
112
113/*--------------------------------------------------------------------------*/
114/*--------------------------- NAMESPACE ------------------------------------*/
115/*--------------------------------------------------------------------------*/
116
117namespace ADS
118{
119
120/*--------------------------------------------------------------------------*/
121/*------------------------------- FUNCTIONS --------------------------------*/
122/*--------------------------------------------------------------------------*/
123
198template< Graph G >
199std::vector< int > maxCardinalityMatching( const G & g );
200
254template< class W >
255 requires std::is_arithmetic_v< W > && std::is_signed_v< W >
256std::pair< W , std::vector< std::size_t > >
258 const std::vector< std::tuple< int , int , W > > & E ,
259 bool maxCardinality = false );
260
261/*--------------------------------------------------------------------------*/
262
263} // end( namespace ADS )
264
265/*--------------------------------------------------------------------------*/
266/*-------------------------- IMPLEMENTATION --------------------------------*/
267/*--------------------------------------------------------------------------*/
268
269#include "ADS/graph/impl/BlossomMatching.tpp"
270
271/*--------------------------------------------------------------------------*/
272
273#endif /* BlossomMatching.h included */
274
275/*--------------------------------------------------------------------------*/
276/*----------------------- End File BlossomMatching.h -----------------------*/
277/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
Matchings, the sets of edges of a graph no two of which share an end beyond the capacities of the end...
The visits of a GRAPH of section 9.5 and their applications, each in time on lists or vectors of adj...
The GRAPH of chapter 9 and its realizations.
std::pair< W, std::vector< std::size_t > > maxWeightMatching(int n, const std::vector< std::tuple< int, int, W > > &E, bool maxCardinality=false)
the largest total weight of a matching of the graph of nodes and of the edges , or,...
std::vector< int > maxCardinalityMatching(const G &g)
the mate of each node in a matching of largest size of the unoriented graph , NIL for a node left unm...
Definition ADT.h:96