Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
16 changes: 0 additions & 16 deletions doc/coloring/coloring-family.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------------------------------------------------------------

Expand Down
17 changes: 10 additions & 7 deletions doc/coloring/pgr_sequentialVertexColoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion doc/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)``
Expand Down
6 changes: 4 additions & 2 deletions doc/src/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]_
Expand Down Expand Up @@ -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:

Expand Down
8 changes: 8 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -309,6 +315,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
...............................................................................
Expand Down
38 changes: 19 additions & 19 deletions docqueries/coloring/sequentialVertexColoring.result
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 3 additions & 2 deletions pgtap/coloring/bipartite/types_check.pg
Original file line number Diff line number Diff line change
Expand Up @@ -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$
Expand Down
18 changes: 9 additions & 9 deletions pgtap/coloring/sequentialVertexColoring/edge_cases.pg
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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
Expand All @@ -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');
Expand All @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions pgtap/coloring/sequentialVertexColoring/types_check.pg
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
20 changes: 6 additions & 14 deletions sql/coloring/sequentialVertexColoring.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions sql/scripts/build-extension-update-files.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
}

Expand Down