49template<
typename TCap>
59 while (!queue.
empty()) {
61 if (v == *this->
m_t) {
63 TCap augmentVal = std::numeric_limits<TCap>::max();
64 for (
node w = v; pred[w]; w = pred[w]->theNode()) {
68 if ((*this->
m_cap)[e] - (*this->
m_flow)[e] < augmentVal) {
69 augmentVal = (*this->
m_cap)[e] - (*this->
m_flow)[e];
72 if ((*this->
m_flow)[e] < augmentVal) {
73 augmentVal = (*this->
m_flow)[e];
78 for (
node w = v; pred[w]; w = pred[w]->theNode()) {
82 (*this->
m_flow)[e] += augmentVal;
84 (*this->
m_flow)[e] -= augmentVal;
90 const node w = adj->twinNode();
91 if (w != (*this->
m_s) && !pred[w])
93 const edge e = adj->theEdge();
101 if ((*this->
m_et).greater((*this->
m_flow)[e], (TCap)0)) {
127 this->
m_flow->fill((TCap)0);
134 if (*this->
m_s == *this->
m_t) {
143 edge e = adj->theEdge();
145 flowValue += (*this->
m_flow)[e];
147 flowValue -= (*this->
m_flow)[e];
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Interface for Max Flow Algorithms.
Basic declarations, included by all source files.
Class for adjacency list elements.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Class for the representation of edges.
node target() const
Returns the target node of the edge.
node source() const
Returns the source node of the edge.
Doubly linked lists (maintaining the length of the list).
iterator pushBack(const E &x)
Adds element x at the end of the list.
E popFrontRet()
Removes the first element from the list and returns it.
bool empty() const
Returns true iff the list is empty.
Computes a max flow via Edmonds-Karp.
bool augmentShortestSourceSinkPath()
If there is an augumenting path: do an interation step. Otherwise return false so that the algorithm ...
TCap computeValue(const EdgeArray< TCap > &cap, const node &s, const node &t)
Implementation of computeValue from the super class. The flow array is cleared, cap,...
void computeFlowAfterValue()
Implementation of computeFlowAfterValue from the super class. This does nothing, because the algorith...
const node * m_t
Pointer to the sink node.
virtual void init(const Graph &graph, EdgeArray< TCap > *flow=nullptr)
Initialize the problem with a graph and optional flow array. If no flow array is given,...
EdgeArray< TCap > * m_flow
Pointer to (extern) flow array.
void useEpsilonTest(const double &eps)
Change the used EpsilonTest from StandardEpsilonTest to a user given EpsilonTest.
bool isFeasibleInstance() const
Return whether the instance is feasible, i.e. the capacities are non-negative.
const Graph * m_G
Pointer to the given graph.
const node * m_s
Pointer to the source node.
const EdgeArray< TCap > * m_cap
Pointer to the given capacity array.
MaxFlowModule()
Empty Constructor.
TCap computeFlow(EdgeArray< TCap > &cap, node &s, node &t, EdgeArray< TCap > &flow)
Only a shortcut for computeValue and computeFlowAfterValue.
EpsilonTest * m_et
Pointer to the used EpsilonTest.
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
The namespace for all OGDF objects.