43 template<
typename TCap>
56 while (!queue.
empty()) {
58 if (v == *this->
m_t) {
60 TCap augmentVal = std::numeric_limits<TCap>::max();
61 for (
node w = v; pred[w]; w = pred[w]->theNode()) {
65 if ((*this->
m_cap)[e] - (*this->
m_flow)[e] < augmentVal) {
66 augmentVal = (*this->
m_cap)[e] - (*this->
m_flow)[e];
69 if ((*this->
m_flow)[e] < augmentVal) {
70 augmentVal = (*this->
m_flow)[e];
75 for (
node w = v; pred[w]; w = pred[w]->theNode()) {
79 (*this->
m_flow)[e] += augmentVal;
81 (*this->
m_flow)[e] -= augmentVal;
98 if ( (*this->
m_et).greater( (*this->
m_flow)[e] , (TCap) 0 )) {
132 if (*this->
m_s == *this->
m_t) {
141 flowValue += (*this->
m_flow)[e];
143 flowValue -= (*this->
m_flow)[e];
node target() const
Returns the target node of the edge.
edge theEdge() const
Returns the edge associated with this adjacency entry.
iterator pushBack(const E &x)
Adds element x at the end of the list.
const node * m_t
Pointer to the sink node.
EpsilonTest * m_et
Pointer to the used EpsilonTest.
Interface for Max Flow Algorithms.
const Graph * m_G
Pointer to the given graph.
void fill(const T &x)
Sets all array elements to x.
Computes a max flow via Edmonds-Karp.
Dynamic arrays indexed with nodes.
bool augmentShortestSourceSinkPath()
If there is an augumenting path: do an interation step. Otherwise return false so that the algorithm ...
const node * m_s
Pointer to the source node.
Doubly linked lists (maintaining the length of the list).
EdgeArray< TCap > * m_flow
Pointer to (extern) flow array.
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, s and t are stored and Edmonds&Karp starts. After this first phase, the flow itself is already computed! Returns 0 if source and sink are identical.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Class for the representation of edges.
E popFrontRet()
Removes the first element from the list and returns it.
Class for the representation of nodes.
bool isFeasibleInstance() const
Return whether the instance is feasible, i.e. the capacities are non-negative.
node source() const
Returns the source node of the edge.
The namespace for all OGDF objects.
bool empty() const
Returns true iff the list is empty.
const EdgeArray< TCap > * m_cap
Pointer to the given capacity array.
Class for adjacency list elements.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
void computeFlowAfterValue()
Implementation of computeFlowAfterValue from the super class. This does nothing, because the algorith...
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.