v.net.allpairs(1grass)
π v.net.allpairs β the GRASS manual, but make it a group chat π
okay bestie, so you know how sometimes you need to know every single shortest path between every single pair of nodes in your network? yeah. that's this. it's v.net.allpairs, a GRASS GIS module, and it's lowkey iconic for it.
KEYWORDS: vector, network, shortest path π¦
β¨ SYNOPSIS β¨
v.net.allpairs
v.net.allpairs --help
v.net.allpairs [-g] input=name output=name [arc_layer=string]
[node_layer=string] [cats=range] [where=sql_query]
[arc_column=name] [arc_backward_column=name] [node_column=string]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π Flags π
-gβ use a geodesic calculation for longitude-latitude projects. it's giving "i respect the curve of the earth" π--overwriteβ allow output files to overwrite existing files. pls be careful, it rly does just go for it π--helpβ print usage summary π«Ά--verboseβ verbose module output. it WILL yap π£οΈ--quietβ quiet module output. it will NOT yap π€«--uiβ force launching the GUI dialog β¨
πΈ Parameters πΈ
input=name[required] β name of input vector map. or, alternatively, a data source for direct OGR access πoutput=name[required] β name for output vector map πarc_layer=stringβ arc layer. JSYK, vector features can have category values in different layers, and this number decides which layer to use. when you're doing direct OGR access, this is the layer name instead. Default:1πnode_layer=stringβ node layer. same whole deal as above: vector features have category values in different layers and this number picks which one. with direct OGR access, it's the layer name. Default:2π¦cats=rangeβ category values. Example:1,3,7-9,13βwhere=sql_queryβ WHERE conditions of the SQL statement, without thewherekeyword itself. Example:income < 1000 and population >= 10000π₯arc_column=nameβ arc forward/both direction(s) cost column (number) πarc_backward_column=nameβ arc backward direction cost column (number) πnode_column=stringβ node cost column (number) π
π« DESCRIPTION π«
v.net.allpairs computes the shortest path between each selected node and all the other selected nodes. periodt. the output is a vector map containing the selected nodes and the shortest paths. it's giving "i did the math so you don't have to" π§
π NOTES π
so here's the tea: an attribute table gets created and linked to layer arc_layer. that table has four columns:
catfrom_catto_catcost
each cat entry is the category of the shortest path going from the node with category from_cat to the node with category to_cat. π
and if points are specified via the cats, layer, or where parameters, then the table is filled only for the selected points. no extras, no filler, we're being selective β¨
one more thing bestie: if arc_backward_column is not given, then (and yes, the original says "then then", we keep it real here) the same costs are used for forward and backward arcs. symmetric vibes only π¦
πΈ EXAMPLE πΈ
find the shortest path along roads from selected archsites (the Spearfish sample dataset):
# prepare network: connect archsites to roads with threshold 200
v.net input=roads@PERMANENT points=archsites@PERMANENT \
output=roads_net operation=connect thresh=200
# verify result
v.category input=roads_net option=report
# only lines should have a category in layer 1
# only points should have a category in layer 2
# shortest path between all points with categories 1 - 5 in layer 2
v.net.allpairs input=roads_net cats=1-5 out=roads_net_all
v.db.select roads_net_all
result in matrix form:
from\to 1 3 4 5
1 0 18820.386 17206.651 17373.274
3 18820.386 0 1739.079 9040.575
4 17206.651 1739.079 0 7426.84
5 17373.274 9040.575 7426.84 0
look at that little matrix. she's beautiful. π₯Ήβ¨
π«Ά SEE ALSO π«Ά
v.net.path, v.net.distance β go read these too, they're the friend group π
π AUTHORS π
- Daniel Bundala, Google Summer of Code 2009, Student
- Wolf Bergenheim, Mentor
- Markus Metz
π SOURCE CODE π
Available at: v.net.allpairs 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
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
okay that's the whole thing bestie, ily, go map some networks πβ¨ this was v.net.allpairs(1grass) from the GRASS 8.5.0 Reference Manual πππ¦
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms