pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.15k stars 366 forks source link

GSOC 2024: New function betweennessCentrality to be added in pgRouting #2643

Open bedupako12mas opened 1 month ago

bedupako12mas commented 1 month ago

pgr_betweennessCentrality():

betweennessCentrality(): Betweenness centrality is a measure of node importance based on the number of shortest paths between other node pairs that pass through that node. It uses Brandes algorithm to efficientlycalculate the betweenness centrality for all nodes in a graph. This algorithm is from the Graph Metrics category of Boost Graph Library. It is used in a linear system of equations, can be used to reduce the size needed to store the sparse matrix, improve the usage of distributed memory, enhance data locality, in constraint satisfaction problems, etc.

Main characteristics of the function:

Signature:

betweennessCentrality (Edges SQL)
RETURNS SET OF (vid, centrality)
OR throws

Parameters:

Parameter Type Description
Edges SQL TEXT Inner SQL query, as described below.

Inner Query:

Edges SQL: It should be an SQL query which should return a set of rows with the following columns:

Column Type Default Description
id ANY-INTEGER Identifier of the edge
source ANY-INTEGER Identifier of the first end point vertex of the edge
target ANY-INTEGER Identifier of the second end point vertex of the edge
cost ANY-NUMERICAL | | Weight of the edge (source, target). When negative: edge (source, target) does not exist on the graph.
reverse_cost ANY-NUMERICAL | -1 | Weight of the edge (target, source). When negative: edge (target, source) does not exist on the graph.

Where: ANY-INTEGER = SMALLINT, INTEGER, BIGINT ANY-NUMERICAL = SMALLINT, INTEGER, BIGINT, REAL, FLOAT

Result Columns:

Returns SET OF (vid, centrality)

Column Type Description
vid BIGINT Identifier of the vertex
centrality FLOAT Relative betweenness centrality of the vertex.