Skip to content

v.net.flow

Computes the maximum flow between two sets of nodes in the network.

v.net.flow input=name [arc_layer=string] [node_layer=string] output=name cut=name [arc_column=name] [arc_backward_column=name] [node_column=name] [source_cats=range] [source_where=sql_query] [sink_cats=range] [sink_where=sql_query] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.net.flow input=name output=name cut=name

grass.script.run_command("v.net.flow", input, arc_layer="1", node_layer="2", output, cut, arc_column=None, arc_backward_column=None, node_column=None, source_cats=None, source_where=None, sink_cats=None, sink_where=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.net.flow", input="name", output="name", cut="name")

Parameters

input=name [required]
    Name of input vector map
    Or data source for direct OGR access
arc_layer=string
    Arc layer
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
    Default: 1
node_layer=string
    Node layer
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
    Default: 2
output=name [required]
    Name for output vector map
cut=name [required]
    Name for output vector map containing a minimum cut
arc_column=name
    Arc forward/both direction(s) cost column (number)
arc_backward_column=name
    Arc backward direction cost column (number)
node_column=name
    Node cost column (number)
source_cats=range
    Source category values
    Example: 1,3,7-9,13
source_where=sql_query
    Source WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
sink_cats=range
    Sink category values
    Example: 1,3,7-9,13
sink_where=sql_query
    Sink WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input vector map
    Or data source for direct OGR access
    Used as: input, vector, name
arc_layer : str, optional
    Arc layer
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
    Used as: input, layer
    Default: 1
node_layer : str, optional
    Node layer
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
    Used as: input, layer
    Default: 2
output : str, required
    Name for output vector map
    Used as: output, vector, name
cut : str, required
    Name for output vector map containing a minimum cut
    Used as: output, vector, name
arc_column : str, optional
    Arc forward/both direction(s) cost column (number)
    Used as: input, dbcolumn, name
arc_backward_column : str, optional
    Arc backward direction cost column (number)
    Used as: input, dbcolumn, name
node_column : str, optional
    Node cost column (number)
    Used as: input, dbcolumn, name
source_cats : str, optional
    Source category values
    Example: 1,3,7-9,13
    Used as: input, cats, range
source_where : str, optional
    Source WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
    Used as: input, sql_query, sql_query
sink_cats : str, optional
    Sink category values
    Example: 1,3,7-9,13
    Used as: input, cats, range
sink_where : str, optional
    Sink WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
    Used as: input, sql_query, sql_query
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

v.net.flow computes the maximum flow and minimum cut between two sets of nodes.

NOTES

The two sets of nodes are called sources and sink and v.net.flow finds the maximum flow from the former to the latter ones. Edge capacities can be specified by arc_column for forward direction and arc_backward_column for backward direction. If the latter parameter is omitted then the same capacity is used in either direction. The sets are given by the respective cats, layer and where parameters. Maximum flow corresponds to the maximum amount of water possibly flowing through the network preserving the capacity constraints and minimum cut to the set of edges of minimum total capacity completely separating sources from sinks. The cut produced by this module corresponds to the first fully saturated edges from sources to sinks. An attribute table containing the flow information is linked to the output map. The table consists of two columns: cat and flow and stores the flow along each line. Negative flow means that "water" is flowing in the backward direction. Cut map contains the edges in the minimum cut.
A famous result says that the total amount of water flowing is equal to the minimum cut.

EXAMPLES

Find maximum flow from factories to stores using SPEED for the capacities.

v.net.flow input=roads output=roads_flow cut=roads_cut arc_column=SPEED \
           source_where="type=factory" sink_where="type=store"

If all the capacties are one then the minimum cut corresponds to the minimum number of edges separating sources from sinks.

v.net.flow input=network output=flow cut=cut arc_column=ones \
           source_cats=1-10 sink_cats=100-100

SEE ALSO

v.net, v.net.connectivity

AUTHORS

Daniel Bundala, Google Summer of Code 2009, Student
Wolf Bergenheim, Mentor

SOURCE CODE

Available at: v.net.flow source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f