135 [[nodiscard]]
int n(
void )
const {
return(
int( f_adj.size() ) ); }
153 [[nodiscard]]
long long flow(
int e )
const;
161 [[nodiscard]]
int places(
void )
const {
return(
int( f_to.size() ) ); }
165 [[nodiscard]]
int tail(
int e )
const {
167 return( f_to[ std::size_t( e ^ 1 ) ] );
172 [[nodiscard]]
int head(
int e )
const {
174 return( f_to[ std::size_t( e ) ] );
233 long long * paths =
nullptr );
251 [[nodiscard]] std::vector< bool >
minCut(
int s )
const;
256 static constexpr long long INF = std::numeric_limits< long long >::max();
259 long long residual(
int e )
const;
263 void push(
int e ,
long long d );
266 [[nodiscard]]
long long inflow(
int t )
const;
301 void rebalance(
int s ,
int t ,
bool excesses =
true );
306 void pushRelabel(
int s ,
int t );
312 [[nodiscard]]
bool preflowFits(
int s )
const;
315 long long bfsAugment(
int s ,
int t );
318 long long dfsAugment(
int s ,
int t );
322 bool levels(
int s ,
int t );
353 long long blocking(
int u ,
int t ,
long long d );
356 [[nodiscard]]
bool skewSymmetric(
void )
const;
366 std::vector< std::vector< Incidence > > f_adj;
368 std::vector< int > f_to;
370 std::vector< long long > f_cap;
371 std::vector< long long > f_res;
374 std::vector< int > f_level;
375 std::vector< std::size_t > f_next;
376 std::vector< long long > f_imb;
378 bool f_unbalanced =
false;
379 std::vector< int > f_imbNodes;
424 std::vector< long long > * flows =
nullptr );
434#include "ADS/graph/impl/MaxFlow.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The push-relabel of Goldberg and Tarjan, the way PUSH_RELABEL of FlowNetwork::maxFlow() [see MaxFlow....
void assignFlow(const std::vector< long long > &F)
the flow of each edge set to , e.g., one that another solver computed, and the excesses and the defi...
std::vector< bool > minCut(int s) const
the side of a minimum cut, the nodes reached from in the residual network, after maxFlow()
int n(void) const
the number of nodes
Definition MaxFlow.h:135
FlowNetwork(int n)
the network of the nodes , with no edge
int tail(int e) const
the tail of the edge number
Definition MaxFlow.h:165
int head(int e) const
the head of the edge number
Definition MaxFlow.h:172
long long capacity(int e) const
the capacity of the edge number
long long maxFlow(int s, int t, Augment how=Augment::DINIC, long long *paths=nullptr)
the maximum flow from to , starting from the flow there is, after the excesses and the deficits left...
int addEdge(int u, int v, long long c)
the edge of capacity , and its number
long long flow(int e) const
the flow on the edge number
void setCapacity(int e, long long c)
the capacity of the edge number set to , its flow kept if at most and cut to otherwise,...
int places(void) const
the number of the places of the edges: the edge , an even number, and its residual twin
Definition MaxFlow.h:161
int addNode(void)
a new node, with no edge, and its number
#define ADS_PRE(cond)
[check]
Definition Contract.h:121
Augment
the way of increasing the flow
Definition MaxFlow.h:113
bool feasibleCirculation(int n, const std::vector< BoundedEdge > &E, std::vector< long long > *flows=nullptr)
whether the edges admit a circulation, a flow conserved at every node with ; then the flows in *flows...
@ DINIC
a blocking flow on the levels of a visit in breadth
Definition MaxFlow.h:116
@ EDMONDS_KARP
a shortest augmenting path, by a visit in breadth
Definition MaxFlow.h:115
@ FORD_FULKERSON
any augmenting path, by a visit in depth
Definition MaxFlow.h:114
@ PUSH_RELABEL
the pushes and the relabelings of a preflow
Definition MaxFlow.h:117
an edge with lower and upper bounds on its flow
Definition MaxFlow.h:385
int v
the head
Definition MaxFlow.h:387
long long high
the largest flow on the edge
Definition MaxFlow.h:389
int u
the tail
Definition MaxFlow.h:386
long long low
the least flow on the edge
Definition MaxFlow.h:388