v.net.flow(1grass)

πŸ’§ v.net.flow β€” the glow-up edition

okay bestie, gather round, because today we're talking about v.net.flow, a GRASS module (yes, from the GRASS User's Manual, and yes it's giving main character energy) that computes the maximum flow between two sets of nodes in the network. that's it, that's the whole vibe. πŸ’–

KEYWORDS: vector, network, flow


✨ SYNOPSIS ✨

no cap, here's the exact invocation situation:

v.net.flow
v.net.flow --help
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]  [--help]
[--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags

  • --overwrite β€” let your output files just, like, bulldoze whatever was already there. Allow output files to overwrite existing files πŸ’…
  • --help β€” print the usage summary, aka the "bestie explain" button
  • --verbose β€” verbose module output, we're being chatty today πŸ™ˆ
  • --quiet β€” quiet module output, shhh, no thoughts head empty
  • --ui β€” force launching the GUI dialog, for when you want the pretty buttons πŸ¦‹

🌸 Parameters

  • input=name [required] β€” name of the input vector map. Or, if you're feeling adventurous, a data source for direct OGR access.
  • arc_layer=string β€” the arc layer. lowkey important: vector features can have category values in different layers, and this number decides which layer we're using. when you're doing direct OGR access this is the layer name instead. default: 1
  • node_layer=string β€” the node layer. same whole situation as above (different layers, pick the number; OGR access means it's the layer name). default: 2
  • output=name [required] β€” the name for the output vector map 🫢
  • cut=name [required] β€” the name for the output vector map that holds 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 an SQL statement, without the 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 an SQL statement, without the where keyword. example: income < 1000 and population >= 10000

πŸ’– DESCRIPTION πŸ’–

v.net.flow computes the maximum flow and minimum cut between two sets of nodes. iconic behaviour honestly. ✨


🌈 NOTES 🌈

so 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. bestie, it's giving plumbing.

edge capacities can be set with arc_column for the forward direction and arc_backward_column for the backward direction. and here's the tea: if you omit that second parameter, the same capacity gets used in either direction. the sets are given by the respective cats, layer and where parameters. πŸŽ€

maximum flow = the maximum amount of water that could possibly flow through the network while preserving the capacity constraints. minimum cut = the set of edges of minimum total capacity that completely separates sources from sinks. the cut this module produces corresponds to the first fully saturated edges from sources to sinks.

an attribute table containing the flow information is linked to the output map. this table has two columns: cat and flow, and it stores the flow along each line. and yes β€” negative flow means that "water" is flowing in the backward direction πŸ’€ weird but true. the 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. periodt. πŸ‘‘

πŸ¦‹ EXAMPLES πŸ¦‹

find the 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"

and if all the capacities are one, then the minimum cut corresponds to the minimum number of edges separating sources from sinks. so slay:

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 May 09 14:33:40 2025 in commit: b356c7e108fcbeca77474c8e83ebec8f1e7b3e4a

main index | vector index | topics index | keywords index | graphical index | full index


okay that's the whole page bestie, go compute some flows and be the main character of your network analysis πŸ’œ

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β€” mwah, that's the GRASS 8.5.0 reference manual era, dated and everything 🌸🧚✨

πŸ“¦ where this page comes from