|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
49 template<
typename TCost>
80 return call(G, lowerBound, upperBound, cost, supply, flow, dual);
188 template<
typename TCost>
193 node s = G.firstNode();
194 node t = G.lastNode();
196 for (
node v : G.nodes) {
201 for (
edge e : G.edges) {
208 for (
node v = G.firstNode(), vl = G.lastNode();
true; v = v->
succ(), vl = vl->
pred()) {
216 if (vl == v->
succ()) {
222 template<
typename TCost>
229 for (
edge e : G.edges) {
230 if (lowerBound[e] > upperBound[e]) {
236 for (
node v : G.nodes) {
243 template<
typename TCost>
249 for (
edge e : G.edges) {
250 if (flow[e] < lowerBound[e] || upperBound[e] < flow[e]) {
254 value += flow[e] * cost[e];
257 for (
node v : G.nodes) {
273 if (sum != supply[v]) {
The namespace for all OGDF objects.
void randomGraph(Graph &G, int n, int m)
Creates a random graph.
Includes declaration of graph class.
static bool checkComputedFlow(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const EdgeArray< TCost > &cost, const NodeArray< int > &supply, const EdgeArray< int > &flow, TCost &value)
checks if a computed flow is a feasible solution to the given problem instance.
Declaration of graph generators.
node pred() const
Returns the predecessor in the list of all nodes.
bool isConnected(const Graph &G)
Returns true iff G is connected.
Class for adjacency list elements.
virtual ~MinCostFlowModule()
edge theEdge() const
Returns the edge associated with this adjacency entry.
static bool checkComputedFlow(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const EdgeArray< TCost > &cost, const NodeArray< int > &supply, const EdgeArray< int > &flow)
checks if a computed flow is a feasible solution to the given problem instance.
bool isSelfLoop() const
Returns true iff the edge is a self-loop (source node = target node).
Decralation of GraphElement and GraphList classes.
Interface for min-cost flow algorithms.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
node source() const
Returns the source node of the edge.
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
MinCostFlowModule()
Initializes a min-cost flow module.
static bool checkProblem(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const NodeArray< int > &supply)
Checks if a given min-cost flow problem instance satisfies the preconditions.
Basic declarations, included by all source files.
node succ() const
Returns the successor in the list of all nodes.
virtual bool call(const Graph &G, const EdgeArray< int > &lowerBound, const EdgeArray< int > &upperBound, const EdgeArray< TCost > &cost, const NodeArray< int > &supply, EdgeArray< int > &flow)
Computes a min-cost flow in the directed graph G.
Class for the representation of edges.
int randomNumber(int low, int high)
Returns random integer between low and high (including).
Class for the representation of nodes.
static void generateProblem(Graph &G, int n, int m, EdgeArray< int > &lowerBound, EdgeArray< int > &upperBound, EdgeArray< TCost > &cost, NodeArray< int > &supply)
Generates an instance of a min-cost flow problem with n nodes and m + n edges.
Declaration of simple graph algorithms.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.