From 358e06d324f03e7387a5cd44d79d3791875f051a Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Fri, 10 Mar 2023 16:22:19 -0500 Subject: [PATCH 01/11] clarify pgr_degree use --- doc/topology/pgr_degree.rst | 2 +- doc/topology/topology-functions.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/topology/pgr_degree.rst b/doc/topology/pgr_degree.rst index fd93b804617..7f64c57d8d4 100644 --- a/doc/topology/pgr_degree.rst +++ b/doc/topology/pgr_degree.rst @@ -13,7 +13,7 @@ ``pgr_degree`` -- Proposed =============================================================================== -``pgr_degree`` — Calculates the vertices degree +``pgr_degree`` — For each vertex in an undirected graph, returns the count of edges incident to the vertex. .. include:: proposed.rst diff --git a/doc/topology/topology-functions.rst b/doc/topology/topology-functions.rst index a1734407b55..d5e1bced8be 100644 --- a/doc/topology/topology-functions.rst +++ b/doc/topology/topology-functions.rst @@ -60,7 +60,7 @@ have special permissions given by the administrators to use them. These proposed functions do not modify the database. -- :doc:`pgr_degree` - Calculates the degree of the vertices of a graph. +- :doc:`pgr_degree` - Returns a set of vertices and corresponding count of incidet edges to the vertex. - :doc:`pgr_extractVertices` - Extracts vertex information based on the edge table information. From 33162a8a6aa788471f1e3f3ba30658a4c2f05e1b Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sat, 1 Apr 2023 18:20:27 -0400 Subject: [PATCH 02/11] Degree refinements 1. Show example using a prepped edges table 2. More discussion of why we can skip degree in some cases --- doc/topology/pgr_degree.rst | 10 +++++++++- docqueries/topology/degree.test.sql | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/topology/pgr_degree.rst b/doc/topology/pgr_degree.rst index 7f64c57d8d4..464d4817978 100644 --- a/doc/topology/pgr_degree.rst +++ b/doc/topology/pgr_degree.rst @@ -13,7 +13,7 @@ ``pgr_degree`` -- Proposed =============================================================================== -``pgr_degree`` — For each vertex in an undirected graph, returns the count of edges incident to the vertex. +``pgr_degree`` — For each vertex in an undirected graph, returns the count of edges incident to the vertex .. include:: proposed.rst @@ -49,6 +49,10 @@ Signatures :Example: Extracting the vertex information +pgr_degree can utilize output from `pgr_extractVertices` or can have `pgr_extractVertices` embedded in the call. +For decent size networks, it is best to prep your vertices table before hand and use that vertices table +for pgr_degree calls. + .. literalinclude:: degree.queries :start-after: -- q1 :end-before: -- q2 @@ -171,6 +175,10 @@ development needs. Degree from an existing table ............................................................................... +If you have a vertices table already built using ``pgr_extractVertices`` +and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree +and work with the ``in_edges`` and ``out_edges`` columns directly. + .. include:: pgRouting-concepts.rst :start-after: degree_from_table_start diff --git a/docqueries/topology/degree.test.sql b/docqueries/topology/degree.test.sql index 52f0a7d677b..5037ad259cb 100644 --- a/docqueries/topology/degree.test.sql +++ b/docqueries/topology/degree.test.sql @@ -1,10 +1,13 @@ -- CopyRight(c) pgRouting developers -- Creative Commons Attribution-Share Alike 3.0 License : https://creativecommons.org/licenses/by-sa/3.0/ /* -- q1 */ +CREATE TEMP TABLE tmp_edges_vertices_pgr IF NOT EXISTS AS +SELECT id, in_edges, out_edges + FROM pgr_extractVertices('SELECT id, geom FROM edges'); SELECT * FROM pgr_degree( $$SELECT id FROM edges$$, $$SELECT id, in_edges, out_edges - FROM pgr_extractVertices('SELECT id, geom FROM edges')$$); + FROM tmp_edges_vertices_pgr$$); /* -- q2 */ SELECT * FROM pgr_degree( $$SELECT id FROM edges WHERE id < 17$$, From 78c35826a70f897137f94262a7ba97dc294d6ae0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 22:24:13 +0000 Subject: [PATCH 03/11] Update locale: commit a416c4b5e --- .../en/LC_MESSAGES/pgrouting_doc_strings.po | 33 +++++++++++++++++-- locale/pot/pgrouting_doc_strings.pot | 15 +++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po index 550fe959173..96bce99b6fd 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.4.0-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-29 04:51+0000\n" +"POT-Creation-Date: 2023-04-01 22:23+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -9711,7 +9711,9 @@ msgstr "" msgid "``pgr_degree`` -- Proposed" msgstr "" -msgid "``pgr_degree`` — Calculates the vertices degree" +msgid "" +"``pgr_degree`` — For each vertex in an undirected graph, returns the " +"count of edges incident to the vertex" msgstr "" msgid "Calculates the degree of the vertices of an **undirected** graph" @@ -9726,6 +9728,13 @@ msgstr "" msgid "Extracting the vertex information" msgstr "" +msgid "" +"pgr_degree can utilize output from `pgr_extractVertices` or can have " +"`pgr_extractVertices` embedded in the call. For decent size networks, it " +"is best to prep your vertices table before hand and use that vertices " +"table for pgr_degree calls." +msgstr "" + msgid "`Vertex SQL`_" msgstr "" @@ -9794,9 +9803,25 @@ msgstr "" msgid "Degree from an existing table" msgstr "" +msgid "" +"If you have a vertices table already built using ``pgr_extractVertices`` " +"and want the degree of the whole graph rather than a subset, you can " +"forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` " +"columns directly." +msgstr "" + msgid ":doc:`pgr_extractVertices`" msgstr "" +msgid "" +"**Supported versions:** `Latest " +"`__ (`3.5" +" `__) `3.4 " +"`__ `3.3 " +"`__ `3.2 " +"`__" +msgstr "" + msgid "``pgr_depthFirstSearch`` - Proposed" msgstr "" @@ -14648,7 +14673,9 @@ msgstr "" msgid "These proposed functions do not modify the database." msgstr "" -msgid ":doc:`pgr_degree` - Calculates the degree of the vertices of a graph." +msgid "" +":doc:`pgr_degree` - Returns a set of vertices and corresponding count of " +"incidet edges to the vertex." msgstr "" msgid "" diff --git a/locale/pot/pgrouting_doc_strings.pot b/locale/pot/pgrouting_doc_strings.pot index e2a2d80af08..224f4c66629 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 v3.5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-29 04:51+0000\n" +"POT-Creation-Date: 2023-04-01 22:23+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -8386,7 +8386,7 @@ msgstr "" msgid "``pgr_degree`` -- Proposed" msgstr "" -msgid "``pgr_degree`` — Calculates the vertices degree" +msgid "``pgr_degree`` — For each vertex in an undirected graph, returns the count of edges incident to the vertex" msgstr "" msgid "Calculates the degree of the vertices of an **undirected** graph" @@ -8401,6 +8401,9 @@ msgstr "" msgid "Extracting the vertex information" msgstr "" +msgid "pgr_degree can utilize output from `pgr_extractVertices` or can have `pgr_extractVertices` embedded in the call. For decent size networks, it is best to prep your vertices table before hand and use that vertices table for pgr_degree calls." +msgstr "" + msgid "`Vertex SQL`_" msgstr "" @@ -8461,6 +8464,12 @@ msgstr "" msgid "Degree from an existing table" msgstr "" +msgid "If you have a vertices table already built using ``pgr_extractVertices`` and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` columns directly." +msgstr "" + +msgid "If you have a vertices table already built using ``pgr_extractVertices`` and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` columns directly." +msgstr "If you have a vertices table already built using ``pgr_extractVertices`` and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` columns directly." + msgid ":doc:`pgr_extractVertices`" msgstr "" @@ -12478,7 +12487,7 @@ msgstr "" msgid "These proposed functions do not modify the database." msgstr "" -msgid ":doc:`pgr_degree` - Calculates the degree of the vertices of a graph." +msgid ":doc:`pgr_degree` - Returns a set of vertices and corresponding count of incidet edges to the vertex." msgstr "" msgid ":doc:`pgr_extractVertices` - Extracts vertex information based on the edge table information." From d211b44f1da4c18902f792d6cf539ab278d04172 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Tue, 18 Apr 2023 22:28:49 -0400 Subject: [PATCH 04/11] More changes --- doc/topology/pgr_degree.rst | 2 +- docqueries/topology/degree.test.sql | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/topology/pgr_degree.rst b/doc/topology/pgr_degree.rst index 464d4817978..a162e7838e0 100644 --- a/doc/topology/pgr_degree.rst +++ b/doc/topology/pgr_degree.rst @@ -13,7 +13,7 @@ ``pgr_degree`` -- Proposed =============================================================================== -``pgr_degree`` — For each vertex in an undirected graph, returns the count of edges incident to the vertex +``pgr_degree`` — For each vertex in an undirected graph, return the count of edges incident to the vertex. .. include:: proposed.rst diff --git a/docqueries/topology/degree.test.sql b/docqueries/topology/degree.test.sql index 5037ad259cb..7ea57d49124 100644 --- a/docqueries/topology/degree.test.sql +++ b/docqueries/topology/degree.test.sql @@ -1,7 +1,8 @@ -- CopyRight(c) pgRouting developers -- Creative Commons Attribution-Share Alike 3.0 License : https://creativecommons.org/licenses/by-sa/3.0/ /* -- q1 */ -CREATE TEMP TABLE tmp_edges_vertices_pgr IF NOT EXISTS AS +DROP TABLE IF EXISTS tmp_edges_vertices_pgr +CREATE TEMP TABLE tmp_edges_vertices_pgr AS SELECT id, in_edges, out_edges FROM pgr_extractVertices('SELECT id, geom FROM edges'); SELECT * FROM pgr_degree( From 720ad0ba081a8a52e917cf3db202d4ae74d26759 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 02:39:19 +0000 Subject: [PATCH 05/11] Update locale: commit 565fd8d0e --- locale/en/LC_MESSAGES/pgrouting_doc_strings.po | 6 +++--- locale/pot/pgrouting_doc_strings.pot | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po index 96bce99b6fd..99912c7cab7 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.4.0-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-01 22:23+0000\n" +"POT-Creation-Date: 2023-04-19 02:39+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -9712,8 +9712,8 @@ msgid "``pgr_degree`` -- Proposed" msgstr "" msgid "" -"``pgr_degree`` — For each vertex in an undirected graph, returns the " -"count of edges incident to the vertex" +"``pgr_degree`` — For each vertex in an undirected graph, return the count" +" of edges incident to the vertex." msgstr "" msgid "Calculates the degree of the vertices of an **undirected** graph" diff --git a/locale/pot/pgrouting_doc_strings.pot b/locale/pot/pgrouting_doc_strings.pot index 224f4c66629..80caa61500d 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 v3.5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-01 22:23+0000\n" +"POT-Creation-Date: 2023-04-19 02:39+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -8386,7 +8386,7 @@ msgstr "" msgid "``pgr_degree`` -- Proposed" msgstr "" -msgid "``pgr_degree`` — For each vertex in an undirected graph, returns the count of edges incident to the vertex" +msgid "``pgr_degree`` — For each vertex in an undirected graph, return the count of edges incident to the vertex." msgstr "" msgid "Calculates the degree of the vertices of an **undirected** graph" From 2107e30f94468e2d20ca09dfd7a43054b3b59268 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Wed, 19 Apr 2023 13:12:48 -0400 Subject: [PATCH 06/11] Missed ; --- docqueries/topology/degree.test.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docqueries/topology/degree.test.sql b/docqueries/topology/degree.test.sql index 7ea57d49124..95b2e3ba056 100644 --- a/docqueries/topology/degree.test.sql +++ b/docqueries/topology/degree.test.sql @@ -1,7 +1,7 @@ -- CopyRight(c) pgRouting developers -- Creative Commons Attribution-Share Alike 3.0 License : https://creativecommons.org/licenses/by-sa/3.0/ /* -- q1 */ -DROP TABLE IF EXISTS tmp_edges_vertices_pgr +DROP TABLE IF EXISTS tmp_edges_vertices_pgr; CREATE TEMP TABLE tmp_edges_vertices_pgr AS SELECT id, in_edges, out_edges FROM pgr_extractVertices('SELECT id, geom FROM edges'); From f10d992adad8450f5ca84edddb7083cf0ad9fa81 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 15:50:15 +0000 Subject: [PATCH 07/11] Update locale: commit 2107e30f9 --- locale/en/LC_MESSAGES/pgrouting_doc_strings.po | 11 +---------- locale/pot/pgrouting_doc_strings.pot | 5 +---- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po index 99912c7cab7..c882840796a 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.4.0-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-19 02:39+0000\n" +"POT-Creation-Date: 2023-05-16 15:49+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -9813,15 +9813,6 @@ msgstr "" msgid ":doc:`pgr_extractVertices`" msgstr "" -msgid "" -"**Supported versions:** `Latest " -"`__ (`3.5" -" `__) `3.4 " -"`__ `3.3 " -"`__ `3.2 " -"`__" -msgstr "" - msgid "``pgr_depthFirstSearch`` - Proposed" msgstr "" diff --git a/locale/pot/pgrouting_doc_strings.pot b/locale/pot/pgrouting_doc_strings.pot index 80caa61500d..db11a8af431 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 v3.5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-19 02:39+0000\n" +"POT-Creation-Date: 2023-05-16 15:49+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -8467,9 +8467,6 @@ msgstr "" msgid "If you have a vertices table already built using ``pgr_extractVertices`` and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` columns directly." msgstr "" -msgid "If you have a vertices table already built using ``pgr_extractVertices`` and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` columns directly." -msgstr "If you have a vertices table already built using ``pgr_extractVertices`` and want the degree of the whole graph rather than a subset, you can forgo using pgr_degree and work with the ``in_edges`` and ``out_edges`` columns directly." - msgid ":doc:`pgr_extractVertices`" msgstr "" From a42532bdb24ad3ca26373bb46c2bbb17e5d9634b Mon Sep 17 00:00:00 2001 From: cvvergara Date: Tue, 16 May 2023 10:00:06 -0600 Subject: [PATCH 08/11] [dijkstra][doc] double back tick for non translated items --- doc/dijkstra/pgr_dijkstra.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/dijkstra/pgr_dijkstra.rst b/doc/dijkstra/pgr_dijkstra.rst index 199d79104e4..5df11c1deea 100644 --- a/doc/dijkstra/pgr_dijkstra.rst +++ b/doc/dijkstra/pgr_dijkstra.rst @@ -26,9 +26,9 @@ * Standarizing output columns to |short-generic-result| - * ``pgr_dijkstra`` (`One to One`_) added `start_vid` and `end_vid` columns. - * ``pgr_dijkstra`` (`One to Many`_) added `end_vid` column. - * ``pgr_dijkstra`` (`Many to One`_) added `start_vid` column. + * ``pgr_dijkstra`` (`One to One`_) added ``start_vid`` and ``end_vid`` columns. + * ``pgr_dijkstra`` (`One to Many`_) added ``end_vid`` column. + * ``pgr_dijkstra`` (`Many to One`_) added ``start_vid`` column. * Version 3.1.0 From acedab589b3703d6aa78fbd76fcb6d020eae9f64 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Tue, 16 May 2023 10:33:30 -0600 Subject: [PATCH 09/11] [NEWS] adding changes to release notes & news --- NEWS | 26 +++++++++++++++++++++++++- doc/src/release_notes.rst | 26 +++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f4c728278d4..3cae201d9d3 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,31 @@ pgRouting 3.5.1 Release Notes ------------------------------------------------------------------------------- -No Changes Yet +To see all issues & pull requests closed by this release see the `Git closed +milestone for 3.5.1 +`_ + +**Documentation fixes** + +Changes on the documentation to the following: + +* pgr_degree +* pgr_dijkstra +* pgr_ksp +* Automatic page history links + + * using bootstrap_version 2 because 3+ does not do dropdowns + + +**Build fixes** + +* Fix winnie build + +**Code fixes** + +* Fix clang warnings + + * Grouping headers of postgres readers pgRouting 3.5.0 Release Notes ------------------------------------------------------------------------------- diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 684600989f1..192ee60ec3a 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -23,7 +23,31 @@ To see the full list of changes check the list of `Git commits pgRouting 3.5.1 Release Notes ------------------------------------------------------------------------------- -No Changes Yet +To see all issues & pull requests closed by this release see the `Git closed +milestone for 3.5.1 +`_ + +.. rubric:: Documentation fixes + +Changes on the documentation to the following: + +* pgr_degree +* pgr_dijkstra +* pgr_ksp +* Automatic page history links + + * using bootstrap_version 2 because 3+ does not do dropdowns + + +.. rubric:: Build fixes + +* Fix winnie build + +.. rubric:: Code fixes + +* Fix clang warnings + + * Grouping headers of postgres readers pgRouting 3.5.0 Release Notes ------------------------------------------------------------------------------- From 3605437b44176c2f119cab5c830e8036e143e662 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Tue, 16 May 2023 10:44:49 -0600 Subject: [PATCH 10/11] [CI] Update locale only on pgRouting repo --- .github/workflows/update-locale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-locale.yml b/.github/workflows/update-locale.yml index baff77ce591..bf06d7a512a 100644 --- a/.github/workflows/update-locale.yml +++ b/.github/workflows/update-locale.yml @@ -24,6 +24,7 @@ jobs: contents: write # for Git to git push name: Update Locale runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'pgRouting' }} strategy: fail-fast: false From a95c738e0e26232e5320ca67bbda29ca60ffdbb6 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sun, 21 May 2023 18:39:42 -0400 Subject: [PATCH 11/11] Update topology/degree result --- docqueries/topology/degree.result | 207 +++++++++++++++--------------- 1 file changed, 107 insertions(+), 100 deletions(-) diff --git a/docqueries/topology/degree.result b/docqueries/topology/degree.result index bbcf1cd561a..66b10a77d3c 100644 --- a/docqueries/topology/degree.result +++ b/docqueries/topology/degree.result @@ -1,100 +1,107 @@ -BEGIN; -BEGIN -SET client_min_messages TO NOTICE; -SET -/* -- q1 */ -SELECT * FROM pgr_degree( - $$SELECT id FROM edges$$, - $$SELECT id, in_edges, out_edges - FROM pgr_extractVertices('SELECT id, geom FROM edges')$$); - node | degree -------+-------- - 1 | 1 - 2 | 1 - 3 | 2 - 4 | 1 - 5 | 1 - 6 | 3 - 7 | 4 - 8 | 3 - 9 | 1 - 10 | 3 - 11 | 4 - 12 | 3 - 13 | 1 - 14 | 1 - 15 | 2 - 16 | 3 - 17 | 2 -(17 rows) - -/* -- q2 */ -SELECT * FROM pgr_degree( - $$SELECT id FROM edges WHERE id < 17$$, - $$SELECT id, in_edges, out_edges - FROM pgr_extractVertices('SELECT id, geom FROM edges')$$); - node | degree -------+-------- - 1 | 1 - 2 | 0 - 3 | 2 - 4 | 0 - 5 | 1 - 6 | 3 - 7 | 4 - 8 | 3 - 9 | 1 - 10 | 3 - 11 | 4 - 12 | 3 - 13 | 0 - 14 | 0 - 15 | 2 - 16 | 3 - 17 | 2 -(17 rows) - -/* -- q3 */ -SELECT * FROM pgr_degree( - $$SELECT id FROM edges WHERE id < 17$$, - $$SELECT id, in_edges, out_edges - FROM pgr_extractVertices('SELECT id, geom FROM edges')$$, - dryrun => true); -NOTICE: - WITH - - -- a sub set of edges of the graph goes here - g_edges AS ( - SELECT id FROM edges WHERE id < 17 - ), - - -- sub set of vertices of the graph goes here - all_vertices AS ( - SELECT id, in_edges, out_edges - FROM pgr_extractVertices('SELECT id, geom FROM edges') - ), - - g_vertices AS ( - SELECT id, - unnest( - coalesce(in_edges::BIGINT[], '{}'::BIGINT[]) - || - coalesce(out_edges::BIGINT[], '{}'::BIGINT[])) AS eid - FROM all_vertices - ), - - totals AS ( - SELECT v.id, count(*) - FROM g_vertices AS v - JOIN g_edges AS e ON (e.id = eid) GROUP BY v.id - ) - - SELECT id::BIGINT, coalesce(count, 0)::BIGINT FROM all_vertices LEFT JOIN totals USING (id) - ; - node | degree -------+-------- -(0 rows) - -/* -- q4 */ -ROLLBACK; -ROLLBACK +BEGIN; +BEGIN +SET client_min_messages TO NOTICE; +SET +/* -- q1 */ +DROP TABLE IF EXISTS tmp_edges_vertices_pgr; +NOTICE: table "tmp_edges_vertices_pgr" does not exist, skipping +DROP TABLE +CREATE TEMP TABLE tmp_edges_vertices_pgr AS +SELECT id, in_edges, out_edges + FROM pgr_extractVertices('SELECT id, geom FROM edges'); +SELECT 17 +SELECT * FROM pgr_degree( + $$SELECT id FROM edges$$, + $$SELECT id, in_edges, out_edges + FROM tmp_edges_vertices_pgr$$); + node | degree +------+-------- + 1 | 1 + 2 | 1 + 3 | 2 + 4 | 1 + 5 | 1 + 6 | 3 + 7 | 4 + 8 | 3 + 9 | 1 + 10 | 3 + 11 | 4 + 12 | 3 + 13 | 1 + 14 | 1 + 15 | 2 + 16 | 3 + 17 | 2 +(17 rows) + +/* -- q2 */ +SELECT * FROM pgr_degree( + $$SELECT id FROM edges WHERE id < 17$$, + $$SELECT id, in_edges, out_edges + FROM pgr_extractVertices('SELECT id, geom FROM edges')$$); + node | degree +------+-------- + 1 | 1 + 2 | 0 + 3 | 2 + 4 | 0 + 5 | 1 + 6 | 3 + 7 | 4 + 8 | 3 + 9 | 1 + 10 | 3 + 11 | 4 + 12 | 3 + 13 | 0 + 14 | 0 + 15 | 2 + 16 | 3 + 17 | 2 +(17 rows) + +/* -- q3 */ +SELECT * FROM pgr_degree( + $$SELECT id FROM edges WHERE id < 17$$, + $$SELECT id, in_edges, out_edges + FROM pgr_extractVertices('SELECT id, geom FROM edges')$$, + dryrun => true); +NOTICE: + WITH + + -- a sub set of edges of the graph goes here + g_edges AS ( + SELECT id FROM edges WHERE id < 17 + ), + + -- sub set of vertices of the graph goes here + all_vertices AS ( + SELECT id, in_edges, out_edges + FROM pgr_extractVertices('SELECT id, geom FROM edges') + ), + + g_vertices AS ( + SELECT id, + unnest( + coalesce(in_edges::BIGINT[], '{}'::BIGINT[]) + || + coalesce(out_edges::BIGINT[], '{}'::BIGINT[])) AS eid + FROM all_vertices + ), + + totals AS ( + SELECT v.id, count(*) + FROM g_vertices AS v + JOIN g_edges AS e ON (e.id = eid) GROUP BY v.id + ) + + SELECT id::BIGINT, coalesce(count, 0)::BIGINT FROM all_vertices LEFT JOIN totals USING (id) + ; + node | degree +------+-------- +(0 rows) + +/* -- q4 */ +ROLLBACK; +ROLLBACK