diff --git a/NEWS.md b/NEWS.md index e0882b8c7d6..ecd63f1d7bd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -91,6 +91,10 @@ Summary of changes by function * Combinations signature promoted to official. +* pgr_sequentialVertexColoring + + * Output columns standardized to ``(node, color)`` + * pgr_trsp * Function promoted to official. @@ -275,6 +279,8 @@ Standardize output columns of functions with different output columns within ove * [#2924](https://github.com/pgRouting/pgrouting/issues/2924) pgr_bipartite +* [#2927](https://github.com/pgRouting/pgrouting/issues/2927) + pgr_sequentialVertexColoring Removal of SQL deprecated signatures diff --git a/doc/coloring/coloring-family.rst b/doc/coloring/coloring-family.rst index 55f2bf1fdaf..14e2bc1dc52 100644 --- a/doc/coloring/coloring-family.rst +++ b/doc/coloring/coloring-family.rst @@ -81,22 +81,6 @@ Column Type Description .. result-node-color-end -.. result columns start - -Returns set of ``(vertex_id, color_id)`` - -=============== =========== ====================================== -Column Type Description -=============== =========== ====================================== -``vertex_id`` ``BIGINT`` Identifier of the vertex. -``color_id`` ``BIGINT`` Identifier of the color of the vertex. - - - The minimum value of color is 1. - -=============== =========== ====================================== - -.. result columns end - See Also ------------------------------------------------------------------------------- diff --git a/doc/coloring/pgr_sequentialVertexColoring.rst b/doc/coloring/pgr_sequentialVertexColoring.rst index 6d027eb00dc..e5f36496fd9 100644 --- a/doc/coloring/pgr_sequentialVertexColoring.rst +++ b/doc/coloring/pgr_sequentialVertexColoring.rst @@ -25,14 +25,17 @@ graph, using greedy approach. .. rubric:: Availability -* Version 3.3.0 +.. rubric:: Version 4.0.0 - * Function promoted to proposed. +* Output columns standardized to |result_node_color| -* Version 3.2.0 +.. rubric:: Version 3.3.0 - * New experimental function. +* Function promoted to proposed. +.. rubric:: Version 3.2.0 + +* New experimental function. Description ------------------------------------------------------------------------------- @@ -68,7 +71,7 @@ Signatures | pgr_sequentialVertexColoring(`Edges SQL`_) - | Returns set of |result-node-color| + | Returns set of |result_node_color| | OR EMPTY SET :Example: Graph coloring of pgRouting :doc:`sampledata` @@ -100,8 +103,8 @@ Result columns ------------------------------------------------------------------------------- .. include:: coloring-family.rst - :start-after: result columns start - :end-before: result columns end + :start-after: result-node-color-start + :end-before: result-node-color-end See Also diff --git a/doc/conf.py.in b/doc/conf.py.in index eca89e7012a..44a54626383 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -364,7 +364,6 @@ rst_epilog=""" .. |result-generic-no-seq| replace:: ``(seq, [start_vid], node, edge, cost, agg_cost)`` .. |result-1-1-no-seq| replace:: ``(seq, node, edge, cost, agg_cost)`` .. |result-m-1-no-seq| replace:: ``(seq, start_vid, node, edge, cost, agg_cost)`` -.. |result-node-color| replace:: ``(vertex_id, color_id)`` .. |result_node_color| replace:: ``(node, color)`` .. |result_edge_color| replace:: ``(edge, color)`` .. |result-node| replace:: ``(node)`` diff --git a/doc/src/migration.rst b/doc/src/migration.rst index d0709e57a73..c6615447ef1 100644 --- a/doc/src/migration.rst +++ b/doc/src/migration.rst @@ -93,6 +93,8 @@ types. - `Migration of output column name change`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_edwardMoore` [3]_ - `Migration of single path functions`_ + * - .. versionchanged:: 4.0.0 :doc:`pgr_sequentialVertexColoring` [3]_ + - `Migration of output column name change`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_withPoints` [2]_ - `Migration of single path functions`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_withPointsCost` [2]_ @@ -857,10 +859,10 @@ Before update: * To get the old version column names: in the ``SELECT`` clause use ``edge AS edge_id`` and ``color AS color_id`` -.. rubric:: :doc:`pgr_bipartite` +.. rubric:: :doc:`pgr_bipartite` and :doc:`pgr_sequentialVertexColoring` From: |old-node-color| -To: |result-node-color| +To: |result_node_color| Before update: diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 68c205ceffd..481003e1632 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -158,6 +158,12 @@ Summary of changes by function :start-after: Version 4.0.0 :end-before: .. rubric +* pgr_sequentialVertexColoring + + .. include:: pgr_sequentialVertexColoring.rst + :start-after: Version 4.0.0 + :end-before: .. rubric + * pgr_trsp .. include:: pgr_trsp.rst @@ -309,6 +315,8 @@ Standardize output columns of functions with different output columns within ove * `#2924 `__ pgr_bipartite +* `#2927 `__ + pgr_sequentialVertexColoring Removal of SQL deprecated signatures ............................................................................... diff --git a/docqueries/coloring/sequentialVertexColoring.result b/docqueries/coloring/sequentialVertexColoring.result index 4856cc83be2..d33c773d2c6 100644 --- a/docqueries/coloring/sequentialVertexColoring.result +++ b/docqueries/coloring/sequentialVertexColoring.result @@ -7,25 +7,25 @@ SELECT * FROM pgr_sequentialVertexColoring( 'SELECT id, source, target, cost, reverse_cost FROM edges ORDER BY id' ); - vertex_id | color_id ------------+---------- - 1 | 1 - 2 | 1 - 3 | 2 - 4 | 2 - 5 | 1 - 6 | 2 - 7 | 1 - 8 | 2 - 9 | 1 - 10 | 1 - 11 | 2 - 12 | 1 - 13 | 1 - 14 | 2 - 15 | 2 - 16 | 1 - 17 | 2 + node | color +------+------- + 1 | 1 + 2 | 1 + 3 | 2 + 4 | 2 + 5 | 1 + 6 | 2 + 7 | 1 + 8 | 2 + 9 | 1 + 10 | 1 + 11 | 2 + 12 | 1 + 13 | 1 + 14 | 2 + 15 | 2 + 16 | 1 + 17 | 2 (17 rows) /* -- q2 */ diff --git a/pgtap/coloring/bipartite/types_check.pg b/pgtap/coloring/bipartite/types_check.pg index b7dc1d38bc3..a6ccebea0a3 100644 --- a/pgtap/coloring/bipartite/types_check.pg +++ b/pgtap/coloring/bipartite/types_check.pg @@ -43,8 +43,9 @@ BEGIN RETURN QUERY SELECT function_types_eq('pgr_bipartite', - $$SELECT '{text,int8,int8}'::TEXT[] $$ - ); + $$VALUES + ('{text,int8,int8}'::TEXT[]) + $$); END; $BODY$ diff --git a/pgtap/coloring/sequentialVertexColoring/edge_cases.pg b/pgtap/coloring/sequentialVertexColoring/edge_cases.pg index c7db2823013..e4d99c12827 100644 --- a/pgtap/coloring/sequentialVertexColoring/edge_cases.pg +++ b/pgtap/coloring/sequentialVertexColoring/edge_cases.pg @@ -20,16 +20,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); -SELECT CASE WHEN NOT min_version('3.2.0') THEN plan(1) ELSE plan(18) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(18) ELSE plan(1) END; CREATE OR REPLACE FUNCTION edge_cases() RETURNS SETOF TEXT AS $BODY$ BEGIN -IF NOT min_version('3.2.0') THEN +IF NOT min_version('4.0.0') THEN RETURN QUERY - SELECT skip(1, 'Function is new on 3.2.0'); + SELECT skip(1, 'pgr_sequentialVertexColoring: testing only signatures standardaized in v4.0.0.'); RETURN; END IF; @@ -81,8 +81,8 @@ RETURN QUERY SELECT set_eq('q5', $$VALUES (7, 3, 7, 1, 1)$$, 'q5: Graph with two connected vertices'); PREPARE sequentialVertexColoring6 AS -SELECT color_id, count(DISTINCT color_id) -FROM pgr_sequentialVertexColoring('q5') GROUP BY color_id; +SELECT color, count(DISTINCT color) +FROM pgr_sequentialVertexColoring('q5') GROUP BY color; RETURN QUERY SELECT set_eq('sequentialVertexColoring6', $$VALUES (1,1), (2, 1)$$, '6: Both vertices have different color'); @@ -130,7 +130,7 @@ RETURN QUERY SELECT set_eq('q9', $$VALUES (1, 5, 6, 1, 1), (2, 6, 10, -1, 1)$$, 'q9: Graph with three vertices'); PREPARE sequentialVertexColoring10 AS -SELECT count(DISTINCT color_id) FROM pgr_sequentialVertexColoring('q9'); +SELECT count(DISTINCT color) FROM pgr_sequentialVertexColoring('q9'); RETURN QUERY SELECT set_eq('sequentialVertexColoring10', $$VALUES (2)$$, '10: Two colors are required'); @@ -166,7 +166,7 @@ SELECT set_eq('q11', ); PREPARE sequentialVertexColoring12 AS -SELECT count(DISTINCT color_id) +SELECT count(DISTINCT color) FROM pgr_sequentialVertexColoring('q11'); RETURN QUERY @@ -191,7 +191,7 @@ SELECT set_eq('q13', ); PREPARE sequentialVertexColoring14 AS -SELECT count(DISTINCT color_id) FROM pgr_sequentialVertexColoring('q13'); +SELECT count(DISTINCT color) FROM pgr_sequentialVertexColoring('q13'); RETURN QUERY SELECT set_eq('sequentialVertexColoring14', $$VALUES (2)$$, '14: Two colors are required'); @@ -216,7 +216,7 @@ SELECT set_eq('q15', ); PREPARE sequentialVertexColoring16 AS -SELECT count(DISTINCT color_id) FROM pgr_sequentialVertexColoring('q15'); +SELECT count(DISTINCT color) FROM pgr_sequentialVertexColoring('q15'); RETURN QUERY SELECT set_eq('sequentialVertexColoring16', $$VALUES (2)$$, '16: Two colors are required'); diff --git a/pgtap/coloring/sequentialVertexColoring/types_check.pg b/pgtap/coloring/sequentialVertexColoring/types_check.pg index fff65059512..2fe45922e79 100644 --- a/pgtap/coloring/sequentialVertexColoring/types_check.pg +++ b/pgtap/coloring/sequentialVertexColoring/types_check.pg @@ -19,16 +19,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT CASE WHEN NOT min_version('3.2.0') THEN plan(1) ELSE plan(5) END; +SELECT CASE WHEN NOT min_version('4.0.0') THEN plan(1) ELSE plan(5) END; CREATE OR REPLACE FUNCTION types_check() RETURNS SETOF TEXT AS $BODY$ BEGIN - IF NOT min_version('3.2.0') THEN + IF NOT min_version('4.0.0') THEN RETURN QUERY - SELECT skip(1, 'Function is new on 3.2.0'); + SELECT skip(1, 'pgr_sequentialvertexcoloring: testing only signatures standardaized in v4.0.0.'); RETURN; END IF; @@ -38,7 +38,7 @@ BEGIN RETURN QUERY SELECT function_args_eq('pgr_sequentialvertexcoloring', - $$SELECT '{"","vertex_id","color_id"}'::TEXT[] $$ + $$SELECT '{"","node","color"}'::TEXT[] $$ ); RETURN QUERY diff --git a/sql/coloring/sequentialVertexColoring.sql b/sql/coloring/sequentialVertexColoring.sql index df6478ada44..283c2abd9e3 100644 --- a/sql/coloring/sequentialVertexColoring.sql +++ b/sql/coloring/sequentialVertexColoring.sql @@ -27,26 +27,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ----------------------------------- --- pgr_sequentialVertexColoring ----------------------------------- - - ---v3.2 +--3.2 CREATE FUNCTION pgr_sequentialVertexColoring( TEXT, -- edges_sql (required) - OUT vertex_id BIGINT, - OUT color_id BIGINT) + OUT node BIGINT, + OUT color BIGINT) RETURNS SETOF RECORD AS $BODY$ -BEGIN - RETURN QUERY - SELECT a.vertex_id, a.color_id - FROM _pgr_sequentialVertexColoring(_pgr_get_statement($1)) AS a; -END; + SELECT vertex_id, color_id + FROM _pgr_sequentialVertexColoring(_pgr_get_statement($1)); $BODY$ -LANGUAGE plpgsql VOLATILE STRICT; +LANGUAGE SQL VOLATILE STRICT; -- COMMENTS diff --git a/sql/scripts/build-extension-update-files.pl b/sql/scripts/build-extension-update-files.pl index bfe6439acb8..67c1f7c3039 100755 --- a/sql/scripts/build-extension-update-files.pl +++ b/sql/scripts/build-extension-update-files.pl @@ -277,6 +277,7 @@ sub generate_upgrade_script { # Out parameters changed names on v4.0.0 # Experimental functions push @commands, drop_special_case_function("pgr_dagshortestpath(text,text)"); + push @commands, drop_special_case_function("pgr_sequentialvertexcoloring(text)"); push @commands, drop_special_case_function("pgr_bipartite(text)"); }