pgRouting Manual (2.3)

Maximum Flow

«  pgr_contractGraph - Proposed   ::   Contents   ::   pgr_maxFlowPushRelabel Proposed  »


Maximum Flow

The maximum flow through the graph is guaranteed to be the same with all implementations, but the actual flow through each edge may vary.

Warning

These are proposed functions

  • They are not officially of the current release.
  • They likely will not be officially be part of the next release:
    • The functions might not make use of ANY-INTEGER and ANY-NUMERICAL
    • Name might change.
    • Signature might change.
    • Functionality might change.
    • pgTap tests might be missing.
    • Might need c/c++ coding.
    • May lack documentation.
    • Documentation if any might need to be rewritten.
    • Documentation examples might need to be automatically generated.
    • Might need a lot of feedback from the comunity.
    • Might depend on a proposed function of pgRouting
    • Might depend on a deprecated function of pgRouting

Problem definition

A flow network is a directed graph where each edge has a capacity and a flow. The flow through an edge must not exceed the capacity of the edge. Additionally, the incoming and outgoing flow of a node must be equal except the for source which only has outgoing flow, and the destination(sink) which only has incoming flow.

Maximum flow algorithms calculate the maximum flow through the graph and the flow of each edge.

Given the following query:

pgr_maxFlow \((edges\_sql, source\_vertex, sink\_vertex)\)

where \(edges\_sql = \{(id_i, source_i, target_i, capacity_i, reverse\_capacity_i)\}\)

Graph definition

The weighted directed graph, \(G(V,E)\), is defined as:

Maximum flow problem

Given:

  • \(G(V,E)\)
  • \(source\_vertex \in V\) the source vertex
  • \(sink\_vertex \in V\) the sink vertex

Then:

\(pgr\_maxFlow(edges\_sql, source, sink) = \boldsymbol{\Phi}\)

\(\boldsymbol{\Phi} = {(id_i, edge\_id_i, source_i, target_i, flow_i, residual\_capacity_i)}\)

where:

\(\boldsymbol{\Phi}\) is a subset of the original edges with their residual capacity and flow. The maximum flow through the graph can be obtained by aggregating on the source or sink and summing the flow from/to it. In particular:

  • \(id_i = i\)
  • \(edge\_id = id_i \text{ in edges_sql}\)
  • \(residual\_capacity_i = capacity_i - flow_i\)

«  pgr_contractGraph - Proposed   ::   Contents   ::   pgr_maxFlowPushRelabel Proposed  »