v.net.distance finds the nearast element from set to for every element in set from.
These two sets are given by the respective layer, where and cats parameters. The type of to features is specified by to_type parameter and all from features are points. A table is linked to output map containing various information about the relation. More specifically, the table has three columns: cat, tcat and dist storing category of each from feature, category of the nearest to feature and the distance between them respectively. Furthemore, output map contains the shorest path between each cat, tcat pair. Each path consist of several lines. If a line is on the shorest path from a point then the category of this point is assigned to the line. Note that every line may contain more than one category value since single line may be on the shortest path for more than one from feature. And so the shortest paths can be easily obtained by querying lines with corresponding category number.
The costs of arcs in forward and backward direction are specified by afcolumn and abcolumn columns respectively. If abcolumn is not given, the same cost is used in both directions.
Find shortest path and distance from every school to the nearest hospital and show path from school number one.