From c9997032631d1432635e9460ab9a5f3bf84a8de7 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 20 Aug 2025 16:18:31 +0000 Subject: [PATCH 1/7] (bandwidth/pgtap) Adding test files for pgr_bandwidth --- pgtap/metrics/bandwidth/edge_cases.pg | 72 ++++++++++++++++++++++++ pgtap/metrics/bandwidth/inner_query.pg | 45 +++++++++++++++ pgtap/metrics/bandwidth/no_crash_test.pg | 64 +++++++++++++++++++++ pgtap/metrics/bandwidth/types_check.pg | 56 ++++++++++++++++++ tools/testers/no_crash_test.sql | 2 +- 5 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 pgtap/metrics/bandwidth/edge_cases.pg create mode 100644 pgtap/metrics/bandwidth/inner_query.pg create mode 100644 pgtap/metrics/bandwidth/no_crash_test.pg create mode 100644 pgtap/metrics/bandwidth/types_check.pg diff --git a/pgtap/metrics/bandwidth/edge_cases.pg b/pgtap/metrics/bandwidth/edge_cases.pg new file mode 100644 index 00000000000..f03679b86eb --- /dev/null +++ b/pgtap/metrics/bandwidth/edge_cases.pg @@ -0,0 +1,72 @@ +/*PGR-GNU***************************************************************** + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +------ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ********************************************************************PGR-GNU*/ + +BEGIN; + +UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); +SELECT CASE WHEN min_version('4.0.0') THEN plan(4) ELSE plan(1) END; + +CREATE OR REPLACE FUNCTION edge_cases() +RETURNS SETOF TEXT AS +$BODY$ +BEGIN + +IF NOT min_version('4.0.0') THEN + RETURN QUERY SELECT skip(1, 'Function is new on 4.0.0'); + RETURN; +END IF; + +/* Basic test with subset of edges */ +PREPARE basic_q AS + SELECT pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM edges WHERE id < 5' + ) AS bandwidth; + +RETURN QUERY SELECT lives_ok('basic_q', 'Basic bandwidth calculation works'); + +/* Test with different edge sets */ +PREPARE small_q AS + SELECT pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM edges WHERE id < 3' + ) AS bandwidth; + +PREPARE large_q AS + SELECT pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM edges WHERE id < 6' + ) AS bandwidth; + +RETURN QUERY SELECT lives_ok('small_q', 'Small graph bandwidth works'); +RETURN QUERY SELECT lives_ok('large_q', 'Larger graph bandwidth works'); + +/* Test with empty graph */ +PREPARE empty_q AS + SELECT pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM edges WHERE id < 0' + ) AS bandwidth; + +RETURN QUERY SELECT throws_ok('empty_q', NULL, 'Empty graph throws error'); + +END; +$BODY$ +LANGUAGE plpgsql; + +SELECT edge_cases(); + +SELECT finish(); +ROLLBACK; diff --git a/pgtap/metrics/bandwidth/inner_query.pg b/pgtap/metrics/bandwidth/inner_query.pg new file mode 100644 index 00000000000..8185dd9e378 --- /dev/null +++ b/pgtap/metrics/bandwidth/inner_query.pg @@ -0,0 +1,45 @@ + +/*PGR-GNU***************************************************************** + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +------ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ********************************************************************PGR-GNU*/ +BEGIN; + +UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); +SELECT CASE WHEN min_version('4.0.0') THEN plan(54) ELSE plan(1) END; + +CREATE OR REPLACE FUNCTION inner_query() +RETURNS SETOF TEXT AS +$BODY$ +BEGIN + +IF NOT min_version('4.0.0') THEN + RETURN QUERY SELECT skip(1, 'Function is new on 4.0.0'); + RETURN; +END IF; + +RETURN QUERY +SELECT style_dijkstra('pgr_bandwidth(', ')'); + +END; +$BODY$ +LANGUAGE plpgsql; + +SELECT inner_query(); + +SELECT finish(); +ROLLBACK; diff --git a/pgtap/metrics/bandwidth/no_crash_test.pg b/pgtap/metrics/bandwidth/no_crash_test.pg new file mode 100644 index 00000000000..469b855f9c6 --- /dev/null +++ b/pgtap/metrics/bandwidth/no_crash_test.pg @@ -0,0 +1,64 @@ + +/*PGR-GNU***************************************************************** + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +------ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ********************************************************************PGR-GNU*/ +BEGIN; + +UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); +SELECT CASE WHEN min_version('4.0.0') THEN plan(4) ELSE plan(1) END; + +PREPARE edges_q AS +SELECT id, source, target, cost, reverse_cost FROM edges; + +PREPARE null_ret AS +SELECT id FROM vertices WHERE id IN (-1); + +PREPARE null_ret_arr AS +SELECT array_agg(id) FROM vertices WHERE id IN (-1); + + +CREATE OR REPLACE FUNCTION no_crash() +RETURNS SETOF TEXT AS +$BODY$ +DECLARE +params TEXT[]; +subs TEXT[]; +BEGIN + IF NOT min_version('4.0.0') THEN + RETURN QUERY SELECT skip(1, 'Function is new on 4.0.0'); + RETURN; + END IF; + + params = ARRAY[ + '$$SELECT id, source, target, cost, reverse_cost FROM edges$$' + ]::TEXT[]; + subs = ARRAY[ + 'NULL' + ]::TEXT[]; + + RETURN query SELECT * FROM no_crash_test('pgr_bandwidth', params, subs); + +END +$BODY$ +LANGUAGE plpgsql VOLATILE; + + +SELECT * FROM no_crash(); + +SELECT finish(); +ROLLBACK; diff --git a/pgtap/metrics/bandwidth/types_check.pg b/pgtap/metrics/bandwidth/types_check.pg new file mode 100644 index 00000000000..6146a33ff99 --- /dev/null +++ b/pgtap/metrics/bandwidth/types_check.pg @@ -0,0 +1,56 @@ + +/*PGR-GNU***************************************************************** + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +------ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ********************************************************************PGR-GNU*/ +BEGIN; + +SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(1) END; + +CREATE OR REPLACE FUNCTION types_check() +RETURNS SETOF TEXT AS +$BODY$ +BEGIN + + IF NOT min_version('4.0.0') THEN + RETURN QUERY SELECT skip(1, 'pgr_bandwidth:Function is new on 4.0.0'); + RETURN; + END IF; + + RETURN QUERY SELECT has_function('pgr_bandwidth'); + RETURN QUERY SELECT has_function('pgr_bandwidth', ARRAY['text']); + RETURN QUERY SELECT function_returns('pgr_bandwidth', ARRAY['text'], 'bigint'); + + RETURN QUERY + SELECT function_args_eq('pgr_bandwidth', + $$SELECT ('{"",bandwidth}'::TEXT[]) $$ + ); + + RETURN QUERY + SELECT function_types_eq('pgr_bandwidth', + $$VALUES + ('{text, int8}'::TEXT[]) + $$ + ); +END; +$BODY$ +LANGUAGE plpgsql; + +SELECT types_check(); + +SELECT * FROM finish(); +ROLLBACK; diff --git a/tools/testers/no_crash_test.sql b/tools/testers/no_crash_test.sql index 15422e7b582..93d15c73f1b 100644 --- a/tools/testers/no_crash_test.sql +++ b/tools/testers/no_crash_test.sql @@ -33,7 +33,7 @@ BEGIN ELSE IF func='pgr_isplanar' THEN RETURN query SELECT * FROM isnt_empty(q1, 'isnt_empty' || q1); - ELSIF func='pgr_maxFlow' OR func='pgr_maxFlowMinCost_Cost' THEN + ELSIF func='pgr_maxFlow' OR func='pgr_maxFlowMinCost_Cost' OR func = 'pgr_bandwidth' THEN RETURN query SELECT * FROM set_eq(q1, 'SELECT NULL::BIGINT', 'set_eq' || q1); ELSE RETURN query SELECT * FROM is_empty(q1, 'is_empty' || q1); From d64f05e7c6d3f8a380b5f56d9098fe9109bbaaa0 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 20 Aug 2025 16:20:54 +0000 Subject: [PATCH 2/7] (bandwidth/sql) Adding test SQL code for pgr_bandwidth --- sql/metrics/CMakeLists.txt | 2 ++ sql/metrics/_bandwidth.sql | 45 +++++++++++++++++++++++++++++ sql/metrics/bandwidth.sql | 57 +++++++++++++++++++++++++++++++++++++ sql/sigs/pgrouting--4.0.sig | 2 ++ 4 files changed, 106 insertions(+) create mode 100644 sql/metrics/_bandwidth.sql create mode 100644 sql/metrics/bandwidth.sql diff --git a/sql/metrics/CMakeLists.txt b/sql/metrics/CMakeLists.txt index 9b748324e2d..0fe6c65089e 100644 --- a/sql/metrics/CMakeLists.txt +++ b/sql/metrics/CMakeLists.txt @@ -3,6 +3,8 @@ SET(LOCAL_FILES _betweennessCentrality.sql betweennessCentrality.sql degree.sql + _bandwidth.sql + bandwidth.sql ) foreach (f ${LOCAL_FILES}) diff --git a/sql/metrics/_bandwidth.sql b/sql/metrics/_bandwidth.sql new file mode 100644 index 00000000000..d9b15a1aa74 --- /dev/null +++ b/sql/metrics/_bandwidth.sql @@ -0,0 +1,45 @@ +/*PGR-GNU***************************************************************** + +File: _bandwidth.sql + +Template: +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Function developer: +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +********************************************************************PGR-GNU*/ + +-------------------------------- +-- _pgr_bandwidth +-------------------------------- +--v4.0 +CREATE FUNCTION _pgr_bandwidth( + TEXT, + + OUT bandwidth BIGINT +) +RETURNS BIGINT AS +'MODULE_PATHNAME' +LANGUAGE C VOLATILE STRICT +COST ${COST_HIGH}; + +-- COMMENTS +COMMENT ON FUNCTION _pgr_bandwidth(TEXT) +IS 'pgRouting internal function'; diff --git a/sql/metrics/bandwidth.sql b/sql/metrics/bandwidth.sql new file mode 100644 index 00000000000..1c145d64baf --- /dev/null +++ b/sql/metrics/bandwidth.sql @@ -0,0 +1,57 @@ +/*PGR-GNU***************************************************************** + +File: bandwidth.sql + +Template: +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Function developer: +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + ********************************************************************PGR-GNU*/ + +--v4.0 +CREATE FUNCTION pgr_bandwidth( + TEXT, -- edges_sql (required) + + OUT bandwidth BIGINT +) +RETURNS BIGINT +AS +$BODY$ + SELECT bandwidth FROM _pgr_bandwidth(_pgr_get_statement($1)); +$BODY$ +LANGUAGE SQL VOLATILE STRICT +COST ${COST_HIGH}; + +-- COMMENTS + +COMMENT ON FUNCTION pgr_bandwidth(TEXT) +IS 'pgr_bandwidth +- EXPERIMENTAL +- Calculates the bandwidth of graph components based on current vertex ordering. +- Parameters: + - edges SQL with columns: id, source, target, cost [, reverse_cost] +- Returns: + - bandwidth BIGINT +- Documentation: + - ${PROJECT_DOC_LINK}/pgr_bandwidth.html +'; diff --git a/sql/sigs/pgrouting--4.0.sig b/sql/sigs/pgrouting--4.0.sig index 4169adc6097..b3cc81bfa55 100644 --- a/sql/sigs/pgrouting--4.0.sig +++ b/sql/sigs/pgrouting--4.0.sig @@ -14,6 +14,8 @@ pgr_astar(text,bigint,anyarray,boolean,integer,double precision,double precision pgr_astar(text,bigint,bigint,boolean,integer,double precision,double precision) pgr_astar(text,text,boolean,integer,double precision,double precision) _pgr_astar(text,text,boolean,integer,double precision,double precision,boolean) +_pgr_bandwidth(text) +pgr_bandwidth(text) pgr_bdastarcostmatrix(text,anyarray,boolean,integer,numeric,numeric) pgr_bdastarcost(text,anyarray,anyarray,boolean,integer,numeric,numeric) pgr_bdastarcost(text,anyarray,bigint,boolean,integer,numeric,numeric) From cc5b80082430d0eb2dd428b4efb29f0e22045edf Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 20 Aug 2025 16:22:26 +0000 Subject: [PATCH 3/7] (bandwidth/C/C++) Adding test C/C++ code for pgr_bandwidth --- include/drivers/metrics_driver.hpp | 50 +++++++++++++ include/metrics/bandwidth.hpp | 67 +++++++++++++++++ include/process/metrics_process.h | 49 +++++++++++++ src/metrics/CMakeLists.txt | 3 + src/metrics/bandwidth.c | 61 +++++++++++++++ src/metrics/metrics_driver.cpp | 114 +++++++++++++++++++++++++++++ src/metrics/metrics_process.cpp | 81 ++++++++++++++++++++ 7 files changed, 425 insertions(+) create mode 100644 include/drivers/metrics_driver.hpp create mode 100644 include/metrics/bandwidth.hpp create mode 100644 include/process/metrics_process.h create mode 100644 src/metrics/bandwidth.c create mode 100644 src/metrics/metrics_driver.cpp create mode 100644 src/metrics/metrics_process.cpp diff --git a/include/drivers/metrics_driver.hpp b/include/drivers/metrics_driver.hpp new file mode 100644 index 00000000000..e6c41fc47a3 --- /dev/null +++ b/include/drivers/metrics_driver.hpp @@ -0,0 +1,50 @@ +/*PGR-GNU***************************************************************** +File: metrics_driver.hpp + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Developer: +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +Generated with Template by: +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + ********************************************************************PGR-GNU*/ + +#ifndef INCLUDE_DRIVERS_METRICS_DRIVER_HPP_ +#define INCLUDE_DRIVERS_METRICS_DRIVER_HPP_ +#pragma once + +#include +#include +#include + +#include "c_types/iid_t_rt.h" +void +do_metrics( + std::string, + int, + + IID_t_rt**, size_t*, + char**, char**); + +#endif // INCLUDE_DRIVERS_METRICS_DRIVER_HPP_ diff --git a/include/metrics/bandwidth.hpp b/include/metrics/bandwidth.hpp new file mode 100644 index 00000000000..515c0d57679 --- /dev/null +++ b/include/metrics/bandwidth.hpp @@ -0,0 +1,67 @@ +/*PGR-GNU***************************************************************** +File: bandwidth.hpp + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +********************************************************************PGR-GNU*/ + +#ifndef INCLUDE_METRICS_BANDWIDTH_HPP_ +#define INCLUDE_METRICS_BANDWIDTH_HPP_ +#pragma once + +#include +#include +#include + +#include +#include + +#include "cpp_common/base_graph.hpp" +#include "cpp_common/interruption.hpp" + +namespace pgrouting { +namespace metrics { + +template +uint64_t bandwidth(const G &graph) { + CHECK_FOR_INTERRUPTS(); + + try { + const auto& boost_graph = graph.graph; + + return static_cast(boost::bandwidth(boost_graph)); + } catch (boost::exception const& ex) { + (void)ex; + throw; + } catch (std::exception &e) { + (void)e; + throw; + } catch (...) { + throw; + } +} + +} // namespace metrics +} // namespace pgrouting + +#endif // INCLUDE_METRICS_BANDWIDTH_HPP_ diff --git a/include/process/metrics_process.h b/include/process/metrics_process.h new file mode 100644 index 00000000000..5db7a05dd39 --- /dev/null +++ b/include/process/metrics_process.h @@ -0,0 +1,49 @@ +/*PGR-GNU***************************************************************** +File: bandwidth_process.h + +Function's developer: +Copyright (c) 2025 Saloni kumari +Mail: chaudharysaloni2510 at gmail.com + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + ********************************************************************PGR-GNU*/ + +#ifndef INCLUDE_PROCESS_METRICS_PROCESS_H_ +#define INCLUDE_PROCESS_METRICS_PROCESS_H_ +#pragma once + +#ifdef __cplusplus +#include +using IID_t_rt = struct IID_t_rt; +#else +#include +#include +typedef struct IID_t_rt IID_t_rt; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void pgr_process_metrics(const char*, int, IID_t_rt**, size_t*); + +#ifdef __cplusplus +} +#endif + +#endif // INCLUDE_PROCESS_METRICS_PROCESS_H_ diff --git a/src/metrics/CMakeLists.txt b/src/metrics/CMakeLists.txt index c88a1dfd8eb..806ec12fd26 100644 --- a/src/metrics/CMakeLists.txt +++ b/src/metrics/CMakeLists.txt @@ -1,4 +1,7 @@ ADD_LIBRARY(metrics OBJECT betweennessCentrality.c betweennessCentrality_driver.cpp + bandwidth.c + metrics_driver.cpp + metrics_process.cpp ) diff --git a/src/metrics/bandwidth.c b/src/metrics/bandwidth.c new file mode 100644 index 00000000000..b947b021eb9 --- /dev/null +++ b/src/metrics/bandwidth.c @@ -0,0 +1,61 @@ +/*PGR-GNU***************************************************************** +File: bandwidth.c + +Generated with Template by: +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Function's developer: +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + ********************************************************************PGR-GNU*/ + +#include +#include "c_common/postgres_connection.h" + +#include "c_types/iid_t_rt.h" +#include "c_common/debug_macro.h" +#include "c_common/e_report.h" +#include "c_common/time_msg.h" + +#include "process/metrics_process.h" + +PGDLLEXPORT Datum _pgr_bandwidth(PG_FUNCTION_ARGS); +PG_FUNCTION_INFO_V1(_pgr_bandwidth); + + +PGDLLEXPORT Datum +_pgr_bandwidth(PG_FUNCTION_ARGS) { + IID_t_rt *result_tuples = NULL; + size_t result_count = 0; + + pgr_process_metrics( + text_to_cstring(PG_GETARG_TEXT_P(0)), + 0, /* bandwidth */ + &result_tuples, + &result_count); + + if (result_count == 0) { + PG_RETURN_UINT64(0); + } else { + PG_RETURN_UINT64((uint64_t)result_tuples[0].from_vid); + } +} + diff --git a/src/metrics/metrics_driver.cpp b/src/metrics/metrics_driver.cpp new file mode 100644 index 00000000000..c05fa4119b3 --- /dev/null +++ b/src/metrics/metrics_driver.cpp @@ -0,0 +1,114 @@ +/*PGR-GNU***************************************************************** +File: allpairs_driver.cpp + +Generated with Template by: +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Developer: +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +********************************************************************PGR-GNU*/ + +#include "drivers/metrics_driver.hpp" + +#include +#include +#include + +#include "metrics/bandwidth.hpp" +#include "cpp_common/pgdata_getters.hpp" +#include "cpp_common/assert.hpp" +#include "cpp_common/to_postgres.hpp" +#include "c_types/iid_t_rt.h" + +void +do_metrics( + std::string edges_sql, + int which, + + IID_t_rt **return_tuples, + size_t *return_count, + char ** log_msg, + char ** err_msg) { + using pgrouting::to_pg_msg; + using pgrouting::pgr_free; + + std::ostringstream log; + std::ostringstream err; + std::string hint; + + try { + pgassert(!(*log_msg)); + pgassert(!(*err_msg)); + pgassert(!(*return_tuples)); + pgassert(*return_count == 0); + + hint = edges_sql; + auto edges = pgrouting::pgget::get_edges(std::string(edges_sql), true, true); + + if (edges.empty()) { + throw std::string("No edges found"); + } + + hint = ""; + + auto vertices(pgrouting::extract_vertices(edges)); + pgrouting::UndirectedGraph undigraph(vertices); + + undigraph.insert_edges(edges); + + uint64_t result = 0; + + if (which == 0) { + log << "call the function which calculates the bandwidth"; + result = pgrouting::metrics::bandwidth(undigraph); + } + + log << "result = " << result; + + *return_tuples = new IID_t_rt[1]; + (*return_tuples)[0].from_vid = static_cast(result); + *return_count = 1; + + *log_msg = to_pg_msg(log); + } catch (AssertFailedException &except) { + (*return_tuples) = pgr_free(*return_tuples); + (*return_count) = 0; + err << except.what(); + *err_msg = to_pg_msg(err); + *log_msg = to_pg_msg(log); + } catch (const std::string &ex) { + *err_msg = to_pg_msg(ex); + *log_msg = hint.empty()? to_pg_msg(hint) : to_pg_msg(log); + } catch (std::exception &except) { + (*return_tuples) = pgr_free(*return_tuples); + (*return_count) = 0; + err << except.what(); + *err_msg = to_pg_msg(err); + *log_msg = to_pg_msg(log); + } catch(...) { + (*return_tuples) = pgr_free(*return_tuples); + (*return_count) = 0; + err << "Caught unknown exception!"; + *err_msg = to_pg_msg(err); + *log_msg = to_pg_msg(log); + } +} diff --git a/src/metrics/metrics_process.cpp b/src/metrics/metrics_process.cpp new file mode 100644 index 00000000000..36eabfc1d60 --- /dev/null +++ b/src/metrics/metrics_process.cpp @@ -0,0 +1,81 @@ +/*PGR-GNU***************************************************************** +File: metrics_process.cpp + +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +Function's developer: +Copyright (c) 2025 Saloni Kumari +Mail: chaudharysaloni2510 at gmail.com + +Generated with Template by: +Copyright (c) 2025 pgRouting developers +Mail: project@pgrouting.org + +------ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + ********************************************************************PGR-GNU*/ + +#include "process/metrics_process.h" + +#include + +extern "C" { +#include "c_common/postgres_connection.h" +#include "c_common/e_report.h" +#include "c_common/time_msg.h" +} + +#include "c_types/iid_t_rt.h" +#include "cpp_common/assert.hpp" +#include "drivers/metrics_driver.hpp" + +#if 0 +which = 0 -> bandwidth + +This is c++ code, linked as C code, because pgr_process_metrics is called from C code +#endif +void pgr_process_metrics(const char* edges_sql, int which, IID_t_rt **result_tuples, size_t *result_count) { + pgassert(edges_sql); + pgassert(!(*result_tuples)); + pgassert(*result_count == 0); + pgr_SPI_connect(); + char* log_msg = NULL; + char* notice_msg = NULL; + char* err_msg = NULL; + + clock_t start_t = clock(); + do_metrics( + edges_sql, + which, + result_tuples, result_count, + &log_msg, &err_msg); + + if (which == 0) { + time_msg(std::string(" processing pgr_bandwidth").c_str(), start_t, clock()); + } + + if (err_msg && (*result_tuples)) { + pfree(*result_tuples); + (*result_tuples) = NULL; + (*result_count) = 0; + } + + pgr_global_report(&log_msg, ¬ice_msg, &err_msg); + + pgr_SPI_finish(); +} From 2aceee0e654c5954797bbe087386527786a83ce8 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 20 Aug 2025 16:24:05 +0000 Subject: [PATCH 4/7] (bandwidth/docqueries) Adding test documentation examples code for pgr_bandwidth --- docqueries/metrics/CMakeLists.txt | 1 + docqueries/metrics/bandwidth.pg | 88 +++++++++++++++++++++++ docqueries/metrics/bandwidth.result | 107 ++++++++++++++++++++++++++++ docqueries/metrics/test.conf | 1 + 4 files changed, 197 insertions(+) create mode 100644 docqueries/metrics/bandwidth.pg create mode 100644 docqueries/metrics/bandwidth.result diff --git a/docqueries/metrics/CMakeLists.txt b/docqueries/metrics/CMakeLists.txt index 010b2229c9c..958cb16b7a1 100644 --- a/docqueries/metrics/CMakeLists.txt +++ b/docqueries/metrics/CMakeLists.txt @@ -1,5 +1,6 @@ # Do not use extensions SET(LOCAL_FILES + bandwidth betweennessCentrality degree ) diff --git a/docqueries/metrics/bandwidth.pg b/docqueries/metrics/bandwidth.pg new file mode 100644 index 00000000000..86d43dbfa95 --- /dev/null +++ b/docqueries/metrics/bandwidth.pg @@ -0,0 +1,88 @@ +-- CopyRight(c) pgRouting developers +-- Creative Commons Attribution-Share Alike 3.0 License : https://creativecommons.org/licenses/by-sa/3.0/ + +/* -- q1 */ +SELECT * FROM pgr_bandwidth( +'SELECT id, source, target, cost, reverse_cost +FROM edges' +); + +/* -- q2 */ +CREATE TABLE my_edges1 ( + id SERIAL PRIMARY KEY, + source INTEGER, + target INTEGER, + cost DOUBLE PRECISION, + reverse_cost DOUBLE PRECISION +); +/* -- q3 */ +INSERT INTO my_edges1 (source, target, cost, reverse_cost) VALUES +(4, 7, 1, 1), +(7, 4, 1, 1), +(7, 9, 1, 1), +(9, 7, 1, 1), +(7, 0, 1, 1), +(0, 7, 1, 1), +(0, 2, 1, 1), +(2, 0, 1, 1), +(2, 5, 1, 1), +(5, 2, 1, 1), +(5, 9, 1, 1), +(9, 5, 1, 1), +(9, 8, 1, 1), +(8, 9, 1, 1), +(9, 1, 1, 1), +(1, 9, 1, 1), +(5, 1, 1, 1), +(1, 5, 1, 1), +(9, 6, 1, 1), +(6, 9, 1, 1), +(6, 3, 1, 1), +(3, 6, 1, 1), +(1, 3, 1, 1), +(3, 1, 1, 1); +/* -- q4 */ +SELECT * FROM pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM my_edges1' +); + +/* -- q5 */ +CREATE TABLE my_edges2 ( + id SERIAL PRIMARY KEY, + source INTEGER, + target INTEGER, + cost DOUBLE PRECISION, + reverse_cost DOUBLE PRECISION +); +/* -- q6 */ +INSERT INTO my_edges2 (source, target, cost, reverse_cost) VALUES +(0, 1, 1, 1), +(1, 0, 1, 1), +(1, 3, 1, 1), +(3, 1, 1, 1), +(1, 2, 1, 1), +(2, 1, 1, 1), +(2, 4, 1, 1), +(4, 2, 1, 1), +(4, 8, 1, 1), +(8, 4, 1, 1), +(8, 3, 1, 1), +(3, 8, 1, 1), +(3, 5, 1, 1), +(5, 3, 1, 1), +(3, 6, 1, 1), +(6, 3, 1, 1), +(3, 7, 1, 1), +(7, 3, 1, 1), +(8, 7, 1, 1), +(7, 8, 1, 1), +(6, 9, 1, 1), +(9, 6, 1, 1), +(7, 9, 1, 1), +(9, 7, 1, 1); +/* -- q7 */ +SELECT * FROM pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM my_edges2' +); + +/* -- q8 */ diff --git a/docqueries/metrics/bandwidth.result b/docqueries/metrics/bandwidth.result new file mode 100644 index 00000000000..810797844ff --- /dev/null +++ b/docqueries/metrics/bandwidth.result @@ -0,0 +1,107 @@ +BEGIN; +BEGIN +SET client_min_messages TO NOTICE; +SET +/* -- q1 */ +SELECT * FROM pgr_bandwidth( +'SELECT id, source, target, cost, reverse_cost +FROM edges' +); + bandwidth +----------- + 5 +(1 row) + +/* -- q2 */ +CREATE TABLE my_edges1 ( + id SERIAL PRIMARY KEY, + source INTEGER, + target INTEGER, + cost DOUBLE PRECISION, + reverse_cost DOUBLE PRECISION +); +CREATE TABLE +/* -- q3 */ +INSERT INTO my_edges1 (source, target, cost, reverse_cost) VALUES +(4, 7, 1, 1), +(7, 4, 1, 1), +(7, 9, 1, 1), +(9, 7, 1, 1), +(7, 0, 1, 1), +(0, 7, 1, 1), +(0, 2, 1, 1), +(2, 0, 1, 1), +(2, 5, 1, 1), +(5, 2, 1, 1), +(5, 9, 1, 1), +(9, 5, 1, 1), +(9, 8, 1, 1), +(8, 9, 1, 1), +(9, 1, 1, 1), +(1, 9, 1, 1), +(5, 1, 1, 1), +(1, 5, 1, 1), +(9, 6, 1, 1), +(6, 9, 1, 1), +(6, 3, 1, 1), +(3, 6, 1, 1), +(1, 3, 1, 1), +(3, 1, 1, 1); +INSERT 0 24 +/* -- q4 */ +SELECT * FROM pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM my_edges1' +); + bandwidth +----------- + 8 +(1 row) + +/* -- q5 */ +CREATE TABLE my_edges2 ( + id SERIAL PRIMARY KEY, + source INTEGER, + target INTEGER, + cost DOUBLE PRECISION, + reverse_cost DOUBLE PRECISION +); +CREATE TABLE +/* -- q6 */ +INSERT INTO my_edges2 (source, target, cost, reverse_cost) VALUES +(0, 1, 1, 1), +(1, 0, 1, 1), +(1, 3, 1, 1), +(3, 1, 1, 1), +(1, 2, 1, 1), +(2, 1, 1, 1), +(2, 4, 1, 1), +(4, 2, 1, 1), +(4, 8, 1, 1), +(8, 4, 1, 1), +(8, 3, 1, 1), +(3, 8, 1, 1), +(3, 5, 1, 1), +(5, 3, 1, 1), +(3, 6, 1, 1), +(6, 3, 1, 1), +(3, 7, 1, 1), +(7, 3, 1, 1), +(8, 7, 1, 1), +(7, 8, 1, 1), +(6, 9, 1, 1), +(9, 6, 1, 1), +(7, 9, 1, 1), +(9, 7, 1, 1); +INSERT 0 24 +/* -- q7 */ +SELECT * FROM pgr_bandwidth( + 'SELECT id, source, target, cost, reverse_cost FROM my_edges2' +); + bandwidth +----------- + 5 +(1 row) + +/* -- q8 */ +ROLLBACK; +ROLLBACK diff --git a/docqueries/metrics/test.conf b/docqueries/metrics/test.conf index 252681dc40f..cb97b83ff04 100644 --- a/docqueries/metrics/test.conf +++ b/docqueries/metrics/test.conf @@ -3,6 +3,7 @@ %main::tests = ( 'any' => { 'files' => [qw( + bandwidth.pg betweennessCentrality.pg degree.pg )] From 1f9ce8f9340da4a96fecde2f7a379c79a76f4572 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 20 Aug 2025 16:25:25 +0000 Subject: [PATCH 5/7] (bandwidth/doc) Adding test documentation for pgr_bandwidth --- doc/_static/page_history.js | 1 + doc/metrics/CMakeLists.txt | 1 + doc/metrics/metrics-family.rst | 3 + doc/metrics/pgr_bandwidth.rst | 163 +++++++++++++++++++++++++++++ doc/src/pgRouting-introduction.rst | 2 + 5 files changed, 170 insertions(+) create mode 100644 doc/metrics/pgr_bandwidth.rst diff --git a/doc/_static/page_history.js b/doc/_static/page_history.js index c2932c721e9..b86b5d8a87e 100644 --- a/doc/_static/page_history.js +++ b/doc/_static/page_history.js @@ -15,6 +15,7 @@ var titles = [ var newpages = [ + {v: '4.0', pages: ['pgr_bandwidth']}, {v: '3.8', pages: ['pgr_contractionDeadEnd', 'pgr_contractionLinear', 'pgr_separateCrossing', 'pgr_separateTouching']}, diff --git a/doc/metrics/CMakeLists.txt b/doc/metrics/CMakeLists.txt index d668b5a950c..ea4d6f6c0c1 100644 --- a/doc/metrics/CMakeLists.txt +++ b/doc/metrics/CMakeLists.txt @@ -3,6 +3,7 @@ SET(LOCAL_FILES metrics-family.rst pgr_betweennessCentrality.rst pgr_degree.rst + pgr_bandwidth.rst ) foreach (f ${LOCAL_FILES}) diff --git a/doc/metrics/metrics-family.rst b/doc/metrics/metrics-family.rst index a4458c51fe8..2f8499bafb5 100644 --- a/doc/metrics/metrics-family.rst +++ b/doc/metrics/metrics-family.rst @@ -31,6 +31,8 @@ Metrics - Family of functions * :doc:`pgr_betweennessCentrality` - Calculates relative betweenness centrality using Brandes Algorithm +* :doc:`pgr_bandwidth` - Computes the bandwidth of a graph. + .. experimental-end .. toctree:: @@ -38,6 +40,7 @@ Metrics - Family of functions pgr_degree pgr_betweennessCentrality + pgr_bandwidth See Also ------------------------------------------------------------------------------- diff --git a/doc/metrics/pgr_bandwidth.rst b/doc/metrics/pgr_bandwidth.rst new file mode 100644 index 00000000000..33b5b706af4 --- /dev/null +++ b/doc/metrics/pgr_bandwidth.rst @@ -0,0 +1,163 @@ +.. + **************************************************************************** + pgRouting Manual + Copyright(c) pgRouting Contributors + + This documentation is licensed under a Creative Commons Attribution-Share + Alike 3.0 License: https://creativecommons.org/licenses/by-sa/3.0/ + **************************************************************************** + +.. index:: + single: Metrics Family ; pgr_bandwidth - Experimental + single: bandwidth - Experimental on v4.0 + +| + +``pgr_bandwidth`` - Experimental +=============================================================================== + +``pgr_bandwidth`` - Calculates the bandwidth of the graph + +.. include:: experimental.rst + :start-after: warning-begin + :end-before: end-warning + +.. rubric:: Availability + +.. rubic:: Version 4.0.0 + +* New experimental function. + +Description +------------------------------------------------------------------------------- + +Bandwidth measures how "spread out" the connections are in a graph when vertices are arranged in a linear order (like numbering them 1, 2, 3, etc.). + +* For each edge in the graph, calculate the distance between the vertex numbers it connects +* The bandwidth is the maximum of all these distances +* The implementation is for undirected graphs +* Run time is 0.160789 seconds + +|Boost| Boost Graph Inside + +Signatures +------------------------------------------------------------------------------- + +.. rubric:: Summary + +.. admonition:: \ \ + :class: signatures + + pgr_bandwidth(`Edges SQL`_) + + | Returns ``BIGINT`` + +:Example: For an undirected graph with edges. + +.. literalinclude:: bandwidth.queries + :start-after: -- q1 + :end-before: -- q2 + +Parameters +------------------------------------------------------------------------------- + +.. include:: pgRouting-concepts.rst + :start-after: edges_start + :end-before: edges_end + +Inner Queries +------------------------------------------------------------------------------- + +Edges SQL +............................................................................... + +.. include:: pgRouting-concepts.rst + :start-after: basic_edges_sql_start + :end-before: basic_edges_sql_end + +Result columns +------------------------------------------------------------------------------- + +Returns a bigint ``(pgr_bandwidth)`` + +================= =========== ========================================== +Column Type Description +================= =========== ========================================== +``pgr_bandwidth`` ``BIGINT`` gives the bandwidth of the graph. +================= =========== ========================================== + +Additional Examples +------------------------------------------------------------------------------- + +:Example: Undirected graph with edges before optimization. + +.. graphviz:: + + graph G { + node [shape=circle, style=filled, fillcolor=white, color=black, fontcolor=black, fontsize=10]; + edge [color=black, penwidth=1]; + + 4 -- 7; + 7 -- 9; + 7 -- 0; + 0 -- 2; + 2 -- 5; + 5 -- 9; + 9 -- 8; + 9 -- 1; + 5 -- 1; + 9 -- 6; + 6 -- 3; + 1 -- 3; + + {rank=same; 4; 8; 6;} + {rank=same; 7; 9; 3;} + {rank=same; 0; 2; 5; 1;} + } + +.. literalinclude:: bandwidth.queries + :start-after: -- q2 + :end-before: -- q5 + +:Example: Undirected graph with edges after optimization. + +.. graphviz:: + + graph G { + node [shape=circle, style=filled, fillcolor=white, color=black, fontcolor=black, fontsize=12]; + edge [color=black, penwidth=1]; + + 0 -- 1; + 1 -- 3; + 1 -- 2; + 2 -- 4; + 4 -- 8; + 8 -- 3; + 3 -- 5; + 3 -- 6; + 3 -- 7; + 8 -- 7; + 6 -- 9; + 7 -- 9; + + {rank=same; 0; 5; 6;} + {rank=same; 1; 3; 9;} + {rank=same; 2; 4; 8; 7;} + + } + +.. literalinclude:: bandwidth.queries + :start-after: -- q5 + :end-before: -- q8 + +See Also +------------------------------------------------------------------------------- + +* :doc:`sampledata` +* `Boost: bandwidth + `_ + +.. rubric:: Indices and tables + +* :ref:`genindex` +* :ref:`search` diff --git a/doc/src/pgRouting-introduction.rst b/doc/src/pgRouting-introduction.rst index 3529dd05777..c06b03b287e 100644 --- a/doc/src/pgRouting-introduction.rst +++ b/doc/src/pgRouting-introduction.rst @@ -67,6 +67,7 @@ Individuals in this release v4.0.0 (in alphabetical order) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Regina Obe, +Saloni kumari, Vicky Vergara @@ -144,6 +145,7 @@ Rajat Shinde, Razequl Islam, Regina Obe, Rohith Reddy, +Saloni Kumari, Sarthak Agarwal, Shobhit Chaurasia, Sourabh Garg, From 9edc0b59bf05afb48dfa15a081df5cf46192d27f Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 20 Aug 2025 16:42:44 +0000 Subject: [PATCH 6/7] Updating release notes and NEWS about the new function pgr_bandwidth --- NEWS.md | 10 ++++++++++ doc/src/release_notes.rst | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/NEWS.md b/NEWS.md index 20d939ff0fe..6eb3d04476c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -60,6 +60,10 @@ Summary of changes by function * Combinations signature promoted to official. +* pgr_bandwidth + + * New experimental function. + * pgr_bdAstar * Combinations signature promoted to official. @@ -288,6 +292,12 @@ Signatures promoted to official * [#2718](https://github.com/pgRouting/pgrouting/issues/2718): pgr_maxFlow(Combinations) * [#2718](https://github.com/pgRouting/pgrouting/issues/2718): pgr_pushRelabel(Combinations) +New experimental functions + +* Metrics + + * [#2951](https://github.com/pgRouting/pgrouting/issues/2951): pgr_bandwidth + SQL signatures and output standardization [#2904](https://github.com/pgRouting/pgrouting/issues/2904): Standardize output columns of functions with different output diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 0f2009f6ba3..c737882b279 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -100,6 +100,12 @@ Summary of changes by function :start-after: Version 4.0.0 :end-before: .. rubric +* pgr_bandwidth + + .. include:: pgr_bandwidth.rst + :start-after: Version 4.0.0 + :end-before: Description + * pgr_bdAstar .. include:: pgr_bdAstar.rst @@ -341,6 +347,13 @@ Signatures promoted to official * :issue:`2718`: pgr_maxFlow(Combinations) * :issue:`2718`: pgr_pushRelabel(Combinations) +New experimental functions +............................................................................... + +* Metrics + + * :issue:`2951`: pgr_bandwidth + SQL signatures and output standardization ............................................................................... From 5168fdb2d4632e2bd62b79570ea2150ea1d4980e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 17:25:30 +0000 Subject: [PATCH 7/7] Update locale: commit 9edc0b59b --- .../en/LC_MESSAGES/pgrouting_doc_strings.po | 94 ++++++++++++++++--- locale/pot/pgrouting_doc_strings.pot | 83 +++++++++++++--- 2 files changed, 149 insertions(+), 28 deletions(-) diff --git a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po index b4824c2a7fe..fb2d91906b3 100644 --- a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po +++ b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pgRouting v3.8\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-18 16:23+0000\n" +"POT-Creation-Date: 2025-08-20 17:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3409,6 +3409,9 @@ msgid "" "centrality using Brandes Algorithm" msgstr "" +msgid ":doc:`pgr_bandwidth` - Computes the bandwidth of a graph." +msgstr "" + msgid ":doc:`TRSP-family`" msgstr "" @@ -3994,6 +3997,12 @@ msgstr "" msgid "pgr_aStarCost" msgstr "" +msgid "pgr_bandwidth" +msgstr "" + +msgid "New experimental function." +msgstr "" + msgid "pgr_bdAstar" msgstr "" @@ -4350,6 +4359,17 @@ msgid "" "pgr_pushRelabel(Combinations)" msgstr "" +msgid "New experimental functions" +msgstr "" + +msgid "Metrics" +msgstr "" + +msgid "" +"`#2951 `__: " +"pgr_bandwidth" +msgstr "" + msgid "SQL signatures and output standardization" msgstr "" @@ -8226,7 +8246,7 @@ msgstr "" msgid "Individuals in this release v4.0.0 (in alphabetical order)" msgstr "" -msgid "Regina Obe, Vicky Vergara" +msgid "Regina Obe, Saloni kumari, Vicky Vergara" msgstr "" msgid "" @@ -8281,9 +8301,9 @@ msgid "" "Nagase, Mahmoud Sakr, Manikata Kondeti, Mario Basa, Martin Wiesenhaan, " "Maxim Dubinin, Maoguang Wang, Mohamed Bakli, Mohamed Zia, Mukul Priya, " "Nitish Chauhan, Rajat Shinde, Razequl Islam, Regina Obe, Rohith Reddy, " -"Sarthak Agarwal, Shobhit Chaurasia, Sourabh Garg, Stephen Woodbridge, " -"Swapnil Joshi, Sylvain Housseman, Sylvain Pasche, Veenit Kumar, Vidhan " -"Jain, Virginia Vergara, Yige Huang" +"Saloni Kumari, Sarthak Agarwal, Shobhit Chaurasia, Sourabh Garg, Stephen " +"Woodbridge, Swapnil Joshi, Sylvain Housseman, Sylvain Pasche, Veenit " +"Kumar, Vidhan Jain, Virginia Vergara, Yige Huang" msgstr "" msgid "Corporate Sponsors (in alphabetical order)" @@ -9102,9 +9122,6 @@ msgstr "" msgid "Version 2.5.0" msgstr "" -msgid "New experimental function." -msgstr "" - msgid "" "Those vertices that belong to more than one biconnected component are " "called articulation points or, equivalently, cut vertices. Articulation " @@ -9147,6 +9164,59 @@ msgid "" "`__" msgstr "" +msgid "``pgr_bandwidth`` - Experimental" +msgstr "" + +msgid "``pgr_bandwidth`` - Calculates the bandwidth of the graph" +msgstr "" + +msgid "" +"Bandwidth measures how \"spread out\" the connections are in a graph when" +" vertices are arranged in a linear order (like numbering them 1, 2, 3, " +"etc.)." +msgstr "" + +msgid "" +"For each edge in the graph, calculate the distance between the vertex " +"numbers it connects" +msgstr "" + +msgid "The bandwidth is the maximum of all these distances" +msgstr "" + +msgid "The implementation is for undirected graphs" +msgstr "" + +msgid "Run time is 0.160789 seconds" +msgstr "" + +msgid "pgr_bandwidth(`Edges SQL`_)" +msgstr "" + +msgid "Returns ``BIGINT``" +msgstr "" + +msgid "For an undirected graph with edges." +msgstr "" + +msgid "Returns a bigint ``(pgr_bandwidth)``" +msgstr "" + +msgid "``pgr_bandwidth``" +msgstr "" + +msgid "gives the bandwidth of the graph." +msgstr "" + +msgid "Undirected graph with edges before optimization." +msgstr "" + +msgid "Undirected graph with edges after optimization." +msgstr "" + +msgid "`Boost: bandwidth `_" +msgstr "" + msgid "``pgr_bdAstar``" msgstr "" @@ -10610,7 +10680,7 @@ msgid "" "and shortcut edges created." msgstr "" -msgid "New **experimental** function" +msgid "New experimental function" msgstr "" msgid "" @@ -16171,12 +16241,6 @@ msgstr "" msgid "CI does not test for PostgreSQL 12" msgstr "" -msgid "New experimental functions" -msgstr "" - -msgid "Metrics" -msgstr "" - msgid "pgr_betweennessCentrality" msgstr "" diff --git a/locale/pot/pgrouting_doc_strings.pot b/locale/pot/pgrouting_doc_strings.pot index a5d15eb1206..ab530b56299 100644 --- a/locale/pot/pgrouting_doc_strings.pot +++ b/locale/pot/pgrouting_doc_strings.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pgRouting v4.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-18 16:23+0000\n" +"POT-Creation-Date: 2025-08-20 17:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3082,6 +3082,9 @@ msgstr "" msgid ":doc:`pgr_betweennessCentrality` - Calculates relative betweenness centrality using Brandes Algorithm" msgstr "" +msgid ":doc:`pgr_bandwidth` - Computes the bandwidth of a graph." +msgstr "" + msgid ":doc:`TRSP-family`" msgstr "" @@ -3589,6 +3592,12 @@ msgstr "" msgid "pgr_aStarCost" msgstr "" +msgid "pgr_bandwidth" +msgstr "" + +msgid "New experimental function." +msgstr "" + msgid "pgr_bdAstar" msgstr "" @@ -3895,6 +3904,15 @@ msgstr "" msgid "`#2718 `__: pgr_pushRelabel(Combinations)" msgstr "" +msgid "New experimental functions" +msgstr "" + +msgid "Metrics" +msgstr "" + +msgid "`#2951 `__: pgr_bandwidth" +msgstr "" + msgid "SQL signatures and output standardization" msgstr "" @@ -7036,7 +7054,7 @@ msgstr "" msgid "Individuals in this release v4.0.0 (in alphabetical order)" msgstr "" -msgid "Regina Obe, Vicky Vergara" +msgid "Regina Obe, Saloni kumari, Vicky Vergara" msgstr "" msgid "And all the people that give us a little of their time making comments, finding issues, making pull requests etc. in any of our products: osm2pgrouting, pgRouting, pgRoutingLayer, workshop." @@ -7075,7 +7093,7 @@ msgstr "" msgid "Individuals (in alphabetical order)" msgstr "" -msgid "Aasheesh Tiwari, Abhinav Jain, Aditya Pratap Singh, Adrien Berchet, Akio Takubo, Andrea Nardelli, Anthony Tasca, Anton Patrushev, Aryan Gupta, Ashraf Hossain, Ashish Kumar, Aurélie Bousquet, Cayetano Benavent, Christian Gonzalez, Daniel Kastl, Dapeng Wang, Dave Potts, David Techer, Denis Rykov, Ema Miyawaki, Esteban Zimanyi, Florian Thurkow, Frederic Junod, Gerald Fenoy, Gudesa Venkata Sai Akhil, Hang Wu, Himanshu Raj, Imre Samu, Jay Mahadeokar, Jinfu Leng, Kai Behncke, Kishore Kumar, Ko Nagase, Mahmoud Sakr, Manikata Kondeti, Mario Basa, Martin Wiesenhaan, Maxim Dubinin, Maoguang Wang, Mohamed Bakli, Mohamed Zia, Mukul Priya, Nitish Chauhan, Rajat Shinde, Razequl Islam, Regina Obe, Rohith Reddy, Sarthak Agarwal, Shobhit Chaurasia, Sourabh Garg, Stephen Woodbridge, Swapnil Joshi, Sylvain Housseman, Sylvain Pasche, Veenit Kumar, Vidhan Jain, Virginia Vergara, Yige Huang" +msgid "Aasheesh Tiwari, Abhinav Jain, Aditya Pratap Singh, Adrien Berchet, Akio Takubo, Andrea Nardelli, Anthony Tasca, Anton Patrushev, Aryan Gupta, Ashraf Hossain, Ashish Kumar, Aurélie Bousquet, Cayetano Benavent, Christian Gonzalez, Daniel Kastl, Dapeng Wang, Dave Potts, David Techer, Denis Rykov, Ema Miyawaki, Esteban Zimanyi, Florian Thurkow, Frederic Junod, Gerald Fenoy, Gudesa Venkata Sai Akhil, Hang Wu, Himanshu Raj, Imre Samu, Jay Mahadeokar, Jinfu Leng, Kai Behncke, Kishore Kumar, Ko Nagase, Mahmoud Sakr, Manikata Kondeti, Mario Basa, Martin Wiesenhaan, Maxim Dubinin, Maoguang Wang, Mohamed Bakli, Mohamed Zia, Mukul Priya, Nitish Chauhan, Rajat Shinde, Razequl Islam, Regina Obe, Rohith Reddy, Saloni Kumari, Sarthak Agarwal, Shobhit Chaurasia, Sourabh Garg, Stephen Woodbridge, Swapnil Joshi, Sylvain Housseman, Sylvain Pasche, Veenit Kumar, Vidhan Jain, Virginia Vergara, Yige Huang" msgstr "" msgid "Corporate Sponsors (in alphabetical order)" @@ -7780,9 +7798,6 @@ msgstr "" msgid "Version 2.5.0" msgstr "" -msgid "New experimental function." -msgstr "" - msgid "Those vertices that belong to more than one biconnected component are called articulation points or, equivalently, cut vertices. Articulation points are vertices whose removal would increase the number of connected components in the graph. This implementation can only be used with an undirected graph." msgstr "" @@ -7816,6 +7831,54 @@ msgstr "" msgid "wikipedia: `Biconnected component `__" msgstr "" +msgid "``pgr_bandwidth`` - Experimental" +msgstr "" + +msgid "``pgr_bandwidth`` - Calculates the bandwidth of the graph" +msgstr "" + +msgid "Bandwidth measures how \"spread out\" the connections are in a graph when vertices are arranged in a linear order (like numbering them 1, 2, 3, etc.)." +msgstr "" + +msgid "For each edge in the graph, calculate the distance between the vertex numbers it connects" +msgstr "" + +msgid "The bandwidth is the maximum of all these distances" +msgstr "" + +msgid "The implementation is for undirected graphs" +msgstr "" + +msgid "Run time is 0.160789 seconds" +msgstr "" + +msgid "pgr_bandwidth(`Edges SQL`_)" +msgstr "" + +msgid "Returns ``BIGINT``" +msgstr "" + +msgid "For an undirected graph with edges." +msgstr "" + +msgid "Returns a bigint ``(pgr_bandwidth)``" +msgstr "" + +msgid "``pgr_bandwidth``" +msgstr "" + +msgid "gives the bandwidth of the graph." +msgstr "" + +msgid "Undirected graph with edges before optimization." +msgstr "" + +msgid "Undirected graph with edges after optimization." +msgstr "" + +msgid "`Boost: bandwidth `_" +msgstr "" + msgid "``pgr_bdAstar``" msgstr "" @@ -9013,7 +9076,7 @@ msgstr "" msgid "``pgr_contractionHierarchies`` — Performs graph contraction according to the contraction hierarchies method and returns the contracted vertices and shortcut edges created." msgstr "" -msgid "New **experimental** function" +msgid "New experimental function" msgstr "" msgid "The contraction hierarchies method builds, from an initial order of the vertices, a hierarchical order, giving priority to some vertices during the processing of label fixing of shortest paths algorithms. Furthermore, the contraction hierarchies algorithm adds shortcut edges in the graph, that helps the shortest paths algorithm to follow the created hierarchical graph structure." @@ -13453,12 +13516,6 @@ msgstr "" msgid "CI does not test for PostgreSQL 12" msgstr "" -msgid "New experimental functions" -msgstr "" - -msgid "Metrics" -msgstr "" - msgid "pgr_betweennessCentrality" msgstr ""