Skip to content

v.net.centrality

Computes degree, centrality, betweeness, closeness and eigenvector centrality measures in the network.

v.net.centrality [-ga] input=name [arc_layer=string] [node_layer=string] output=name [cats=range] [where=sql_query] [arc_column=name] [arc_backward_column=name] [node_column=string] [degree=name] [closeness=name] [betweenness=name] [eigenvector=name] [iterations=integer] [error=float] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.net.centrality input=name output=name

grass.script.run_command("v.net.centrality", input, arc_layer="1", node_layer="2", output, cats=None, where=None, arc_column=None, arc_backward_column=None, node_column=None, degree=None, closeness=None, betweenness=None, eigenvector=None, iterations=1000, error=0.1, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.net.centrality", input="name", output="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
cats=range
    Category values
    Example: 1,3,7-9,13
where=sql_query
    WHERE conditions of SQL statement without 'where' keyword
    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)
degree=name
    Name of degree centrality column
closeness=name
    Name of closeness centrality column
betweenness=name
    Name of betweenness centrality column
eigenvector=name
    Name of eigenvector centrality column
iterations=integer
    Maximum number of iterations to compute eigenvector centrality
    Default: 1000
error=float
    Cumulative error tolerance for eigenvector centrality
    Default: 0.1
-g
    Use geodesic calculation for longitude-latitude projects
-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
output : str, required
    Name for output vector map
    Used as: output, vector, name
cats : str, optional
    Category values
    Example: 1,3,7-9,13
    Used as: input, cats, range
where : str, optional
    WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
    Used as: input, sql_query, sql_query
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)
degree : str, optional
    Name of degree centrality column
    Used as: input, dbcolumn, name
closeness : str, optional
    Name of closeness centrality column
    Used as: input, dbcolumn, name
betweenness : str, optional
    Name of betweenness centrality column
    Used as: input, dbcolumn, name
eigenvector : str, optional
    Name of eigenvector centrality column
    Used as: input, dbcolumn, name
iterations : int, optional
    Maximum number of iterations to compute eigenvector centrality
    Default: 1000
error : float, optional
    Cumulative error tolerance for eigenvector centrality
    Default: 0.1
flags : str, optional
    Allowed values: g, a
    g
        Use geodesic calculation for longitude-latitude projects
    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.centrality computes degree, closeness, betweenness and eigenvector centrality measures.

NOTES

The module computes various centrality measures for each node and stores them in the given columns of an attribute table, which is created and linked to the output map. For the description of these, please check the following wikipedia article. If the column name is not given for a measure then that measure is not computed. If -a flag is set then points are added on nodes without points. Also, the points for which the output is computed can be specified by cats, layer and where parameters. However, if any of these parameters is present then -a flag is ignored and no new points are added.
Betweenness measure is not normalised. In order to get the normalised values (between 0 and 1), each number needs to be divided by N choose 2=N*(N-1)/2 where N is the number of nodes in the connected component. Computation of eigenvector measure terminates if the given number of iterations is reached or the cumulative squared error between the successive iterations is less than error.

EXAMPLES

Compute closeness and betweenness centrality measures for each node and produce a map containing not only points already present in the input map but a map with point on every node.

v.net.centrality input=roads output=roads_cent closeness=closeness \
      betweenness=betweenness -a

SEE ALSO

v.net, v.generalize

AUTHORS

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

SOURCE CODE

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