48 template<
typename TCap>
76 OGDF_ASSERT(priority < std::numeric_limits<TCap>::max());
77 return priority + TCap(1);
145 m_partialFlow = (TCap) 0;
149 this->
m_cap = &originalCapacities;
156 embedding.consistencyCheck();
162 m_pred.
init(*this->
m_G,
nullptr);
164 m_visited.
init(*this->
m_G,
false);
165 m_edgeCounter.
init(*this->
m_G, 0);
174 edge lastSaturated =
nullptr;
177 lastSaturated = m_prioritizedEdges->
topElement();
179 m_prioritizedEdges->
pop();
181 (*this->
m_flow)[lastSaturated] = (*this->
m_cap)[lastSaturated];
183 m_pred[lastSaturated->target()] =
nullptr;
201 while (!m_prioritizedEdges->
empty()) {
226 if (saturatedEdge ==
nullptr) {
232 v = saturatedEdge->
source();
239 m_edgeCounter[v] < v->
degree();
240 adj = adj->cyclicSucc())
243 edge e = adj->theEdge();
245 bool visited = m_visited[e];
266 while(m_pred[w] !=
nullptr) {
283 formerSource = e->
source();
287 e = m_pred[formerSource]->adjSource()->theEdge();
298 if(v == *this->
m_s) {
322 TCap value = m_partialFlow + (*this->
m_cap)[e];
343 m_prioritizedEdges->
decrease(e, std::numeric_limits<TCap>::min());
347 m_prioritizedEdges->
pop();
350 (*this->
m_flow)[e] = m_partialFlow - (modCap - (*this->
m_cap)[e]);
368 if(v == e->
target() || w == *this->
m_s) {
370 }
else if(m_pred[v] ==
nullptr || m_pred[w] ==
nullptr) {
372 }
else if(m_pred[w]->source() == *this->
m_s) {
378 w = m_pred[w]->source();
379 v = m_pred[v]->source();
node target() const
Returns the target node of the edge.
void pop()
Removes the topmost element from the queue.
TCap unshiftedTopPriority()
see unshiftedPriority
EdgeArray< bool > m_visited
Whether each edge has was visited.
void init()
Reinitializes the array. Associates the array with no graph.
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
void push(const E &element, const P &priority)
Adds a new element to the queue.
void init()
Reinitializes the array. Associates the array with no graph.
int degree() const
Returns the degree of the node (indegree + outdegree).
Combinatorial embeddings of planar graphs.
const node * m_t
Pointer to the sink node.
void appendEdge(const edge e)
Appends an edge to the current path.
TCap unshiftedPriority(edge e)
To work with unsigned, we need a priority shifting of the elements in the priority queue...
Computes a max flow in s-t-planar network via uppermost paths.
NodeArray< edge > m_pred
The predecessor of each node in the currently uppermost path.
Interface for Max Flow Algorithms.
Declaration of CombinatorialEmbedding and face.
const Graph * m_G
Pointer to the given graph.
Prioritized queue interface wrapper for heaps.
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
adjEntry findCommonFace(const node v, const node w, bool left=true) const
Identifies a common face of two nodes and returns the respective adjacency entry. ...
EdgePathType getPathType(const edge e) const
Performs an alternating backtracking from source and target to determine whether the new node is part...
~MaxFlowSTPlanarItaiShiloach()
Free allocated ressources.
const E & topElement() const
Returns the topmost element in the queue.
const node * m_s
Pointer to the source node.
EdgePathType
Each edge may be part of the source or target path.
void decrease(const E &element, const P &priority)
Decreases the priority of the given element.
void dropEdge(const edge e)
Removes a single edge from the current path.
EdgeArray< TCap > * m_flow
Pointer to (extern) flow array.
PrioritizedMapQueue< edge, TCap > * m_prioritizedEdges
A priority queue for storing all edges currently in a path.
Class for the representation of edges.
void computeFlowAfterValue()
Computes the actual flow on each edge.
Class for the representation of nodes.
Priority queue interface wrapping various heaps.
bool findUppermostPath(const edge saturatedEdge)
Establishes the next uppermost path.
bool isFeasibleInstance() const
Return whether the instance is feasible, i.e. the capacities are non-negative.
NodeArray< NodeType > m_status
The status of each node.
bool isSTPlanar(const Graph &graph, const node s, const node t)
Returns whether G is s-t-planar (i.e.
bool isSelfLoop() const
Returns true iff the edge is a self-loop (source node = target node).
bool empty() const
Checks whether the queue is empty.
NodeType
Each node has a certain type depending on its participation in any path.
node source() const
Returns the source node of the edge.
The namespace for all OGDF objects.
TCap computeValue(const EdgeArray< TCap > &originalCapacities, const node &source, const node &target)
Computes the maximal flow from source to sink.
TCap m_partialFlow
The flow reached thus far (monotonically increasing).
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
const EdgeArray< TCap > * m_cap
Pointer to the given capacity array.
TCap shiftPriority(TCap priority)
see unshiftedPriority
Class for adjacency list elements.
NodeArray< int > m_edgeCounter
The number of edges visited from each node.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.