Skip to content

Commit 95754ad

Browse files
committed
(bandwidth/sql) Adding test SQL code for pgr_bandwidth
1 parent 8fd514f commit 95754ad

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

sql/metrics/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ SET(LOCAL_FILES
33
_betweennessCentrality.sql
44
betweennessCentrality.sql
55
degree.sql
6+
_bandwidth.sql
7+
bandwidth.sql
68
)
79

810
foreach (f ${LOCAL_FILES})

sql/metrics/_bandwidth.sql

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*PGR-GNU*****************************************************************
2+
3+
File: _bandwidth.sql
4+
5+
Template:
6+
Copyright (c) 2025 pgRouting developers
7+
Mail: project@pgrouting.org
8+
9+
Function developer:
10+
Copyright (c) 2025 Saloni Kumari
11+
Mail: chaudharysaloni2510 at gmail.com
12+
13+
This program is free software; you can redistribute it and/or modify
14+
it under the terms of the GNU General Public License as published by
15+
the Free Software Foundation; either version 2 of the License, or
16+
(at your option) any later version.
17+
18+
This program is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
22+
23+
You should have received a copy of the GNU General Public License
24+
along with this program; if not, write to the Free Software
25+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26+
27+
********************************************************************PGR-GNU*/
28+
29+
--------------------------------
30+
-- _pgr_bandwidth
31+
--------------------------------
32+
--v4.0
33+
CREATE FUNCTION _pgr_bandwidth(
34+
TEXT,
35+
36+
OUT bandwidth BIGINT
37+
)
38+
RETURNS BIGINT AS
39+
'MODULE_PATHNAME'
40+
LANGUAGE C VOLATILE STRICT
41+
COST ${COST_HIGH};
42+
43+
-- COMMENTS
44+
COMMENT ON FUNCTION _pgr_bandwidth(TEXT)
45+
IS 'pgRouting internal function';

sql/metrics/bandwidth.sql

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*PGR-GNU*****************************************************************
2+
3+
File: bandwidth.sql
4+
5+
Template:
6+
Copyright (c) 2025 pgRouting developers
7+
Mail: project@pgrouting.org
8+
9+
Function developer:
10+
Copyright (c) 2025 Saloni Kumari
11+
Mail: chaudharysaloni2510 at gmail.com
12+
13+
------
14+
15+
This program is free software; you can redistribute it and/or modify
16+
it under the terms of the GNU General Public License as published by
17+
the Free Software Foundation; either version 2 of the License, or
18+
(at your option) any later version.
19+
20+
This program is distributed in the hope that it will be useful,
21+
but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23+
GNU General Public License for more details.
24+
25+
You should have received a copy of the GNU General Public License
26+
along with this program; if not, write to the Free Software
27+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28+
29+
********************************************************************PGR-GNU*/
30+
31+
--v4.0
32+
CREATE FUNCTION pgr_bandwidth(
33+
TEXT, -- edges_sql (required)
34+
35+
OUT bandwidth BIGINT
36+
)
37+
RETURNS BIGINT
38+
AS
39+
$BODY$
40+
SELECT bandwidth FROM _pgr_bandwidth(_pgr_get_statement($1));
41+
$BODY$
42+
LANGUAGE SQL VOLATILE STRICT
43+
COST ${COST_HIGH};
44+
45+
-- COMMENTS
46+
47+
COMMENT ON FUNCTION pgr_bandwidth(TEXT)
48+
IS 'pgr_bandwidth
49+
- EXPERIMENTAL
50+
- Calculates the bandwidth of graph components based on current vertex ordering.
51+
- Parameters:
52+
- edges SQL with columns: id, source, target, cost [, reverse_cost]
53+
- Returns:
54+
- bandwidth BIGINT
55+
- Documentation:
56+
- ${PROJECT_DOC_LINK}/pgr_bandwidth.html
57+
';

sql/sigs/pgrouting--4.0.sig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pgr_astar(text,bigint,anyarray,boolean,integer,double precision,double precision
1414
pgr_astar(text,bigint,bigint,boolean,integer,double precision,double precision)
1515
pgr_astar(text,text,boolean,integer,double precision,double precision)
1616
_pgr_astar(text,text,boolean,integer,double precision,double precision,boolean)
17+
_pgr_bandwidth(text)
18+
pgr_bandwidth(text)
1719
pgr_bdastarcostmatrix(text,anyarray,boolean,integer,numeric,numeric)
1820
pgr_bdastarcost(text,anyarray,anyarray,boolean,integer,numeric,numeric)
1921
pgr_bdastarcost(text,anyarray,bigint,boolean,integer,numeric,numeric)

0 commit comments

Comments
 (0)