 |
Open Graph Drawing Framework |
v. 2022.02 (Dogwood)
|
|
|
Go to the documentation of this file.
49 template<
typename TCost>
82 return call(G, lowerBound, upperBound, cost, supply, flow, dual);
206 G,lowerBound,upperBound,cost,supply,flow,value);
212 template<
typename TCost>
224 node s = G.firstNode();
225 node t = G.lastNode();
227 for(
node v : G.nodes) {
232 for(
edge e : G.edges) {
239 for(
node v = G.firstNode(), vl = G.lastNode();
true; v = v->
succ(), vl = vl->
pred()) {
253 template<
typename TCost>
263 for(
edge e : G.edges) {
264 if (lowerBound[e] > upperBound[e])
269 for(
node v : G.nodes) {
277 template<
typename TCost>
289 for (
edge e : G.edges) {
290 if (flow[e] < lowerBound[e] || upperBound[e] < flow[e]) {
294 value += flow[e] * cost[e];
297 for (
node v : G.nodes) {
313 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).
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.
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.
Container::value_type sum(const Container &values)
Returns the sum of an iterable container of given values.
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.