Skip to content

v.net.components

Computes strongly and weakly connected components in the network.

v.net.components [-a] input=name [arc_layer=string] [node_layer=string] [arc_column=name] [arc_backward_column=name] [node_column=string] output=name method=string [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.net.components input=name output=name method=string

grass.script.run_command("v.net.components", input, arc_layer="1", node_layer="2", arc_column=None, arc_backward_column=None, node_column=None, output, method, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.net.components", input="name", output="name", method="string")

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
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)
output=name [required]
    Name for output vector map
method=string [required]
    Type of components
    Allowed values: weak, strong
    weak: Weakly connected components
    strong: Strongly connected components
-a
    Add points on nodes
--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
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)
output : str, required
    Name for output vector map
    Used as: output, vector, name
method : str, required
    Type of components
    Allowed values: weak, strong
    weak: Weakly connected components
    strong: Strongly connected components
flags : str, optional
    Allowed values: a
    a
        Add points on nodes
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.components computes the weakly and strongly connected components in a network.

NOTES

Two nodes, u and v are in the same strongly connected component if there are directed paths from u to v and from v to u. The nodes are in the same weakly connected component if, ignoring edge directions, there is a path between them.

The type of components is specified by method parameter. v.net.components creates a table and links it to layer 1. This table contains only two integer columns: cat and comp. If a point or both endpoints of a line belong to the same component then the point/line is written to the output map and appropriate information is stored in the table. If -a flag is set then new points are added on the nodes without points. These points have category numbers larger than any category used in the input map.

One-way roads can be defined by assigning a cost of -1 to the appropriate cost column (arc_column or arc_backward_column). This affects only strongly connected components. Network nodes can be closed by assigning a cost of -1 to the node cost column. All nodes with a cost \< 0 can not be traversed and are end points, while all nodes with a cost ≥ 0 can be traversed. This affects both weakly and strongly connected components.

EXAMPLES

Any road network should form a single strongly connected component. Otherwise, it is impossible to travel between some places.

v.net.components input=roads output=roads_components method=strong

SEE ALSO

v.net, v.category

AUTHORS

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

SOURCE CODE

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