Skip to content

GSOC 2025: New function bandwidth to be added in pgRouting #2951

@Saloni-2005

Description

@Saloni-2005

pgr_bandwidth():

bandwidth(): The bandwidth of a graph is the maximum distance between two adjacent vertices, with distance measured on a line upon which the vertices have been placed at unit intervals. To put it another way, if the vertices of a graph G=(V,E) are each assigned an index from zero to |V| - 1 given by index[v], then the bandwidth of G is

B(G) = max { |index[u] - index[v]| | (u,v) in E }

Main characteristics of the function:

  • Applicable for undirected graphs.
  • Returns the bandwidth of the graph
  • Run time is 0.160789 seconds

Signature:

  • bandwidth()
bandwidth (Edges SQL)
RETURNS (bigint)
OR 0

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 BIGINT 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 (bigint)

Column Type Description
bandwidth BIGINT bandwidth of the graph

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions