-
-
Notifications
You must be signed in to change notification settings - Fork 395
New function : biconnected planar #3135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mohit242-bit
wants to merge
6
commits into
develop
Choose a base branch
from
biconnected-planar-newfun-try1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
57d84a0
[makeBiconnectedPlanar/sql] Adding SQL code for pgr_makeBiconnectedPl…
Mohit242-bit da249a2
[makeBiconnectedPlanar/C/C++] Adding C/C++ code for pgr_makeBiconnect…
Mohit242-bit 639530d
[makeBiconnectedPlanar/pgtap] Adding test files for pgr_makeBiconnect…
Mohit242-bit 1ddb527
[makeBiconnectedPlanar/docqueries] Adding test documentation examples…
Mohit242-bit 528bf20
[makeBiconnectedPlanar/doc] Adding documentation for pgr_makeBiconnec…
Mohit242-bit e66e04d
Updating release notes and NEWS about the new function pgr_makeBiconn…
Mohit242-bit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| :file: This file is part of the pgRouting project. | ||
| :copyright: Copyright (c) 2020-2026 pgRouting developers | ||
| :license: Creative Commons Attribution-Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0 | ||
|
|
||
| .. index:: | ||
| single: Planar Family ; pgr_makeBiconnectedPlanar - Experimental | ||
| single: makeBiconnectedPlanar - Experimental on v4.1 | ||
|
|
||
| | | ||
|
|
||
| ``pgr_makeBiconnectedPlanar`` - Experimental | ||
| =============================================================================== | ||
|
|
||
| ``pgr_makeBiconnectedPlanar`` — Returns the set of edges needed to make each connected component of a planar graph biconnected. | ||
|
|
||
| .. include:: experimental.rst | ||
| :start-after: warning-begin | ||
| :end-before: end-warning | ||
|
|
||
| .. rubric:: Availability | ||
|
|
||
| .. rubric:: Version 4.1.0 | ||
|
|
||
| * New experimental function. | ||
|
|
||
|
|
||
| Description | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| ``pgr_makeBiconnectedPlanar`` identifies the missing edges that need to be added to each | ||
| connected component of an existing planar graph to make those components biconnected, | ||
| while ensuring the graph remains planar. | ||
|
|
||
| A graph is considered **biconnected** if it is connected and cannot be broken into | ||
| disconnected pieces by deleting any single vertex (it has no articulation points). | ||
| A planar graph is one that can be drawn in two-dimensional space with no two of | ||
| its edges crossing. | ||
|
|
||
| The main characteristics are: | ||
|
|
||
| * Works for **undirected** graphs. | ||
| * Works for **planar** graphs only. | ||
| * If any component of the input graph is not planar, no added edges are returned for that component. | ||
| * Returns a list of all new edges needed to make each connected component of the graph biconnected. | ||
| * The algorithm does not consider traversal costs in the calculations. | ||
| * The algorithm does not consider geometric topology in the calculations. | ||
| * Running time: :math:`O(|V_G| + |E_G| + R \log R)` where :math:`G(V_G, E_G)` is the input graph and :math:`R` is the number of returned edges. | ||
|
|
||
| |Boost| Boost Graph Inside | ||
|
|
||
| Signatures | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| .. admonition:: \ \ | ||
| :class: signatures | ||
|
|
||
| | pgr_makeBiconnectedPlanar(`Edges SQL`_) | ||
|
|
||
| | Returns set of |result-component-make| | ||
| | OR EMPTY SET | ||
|
|
||
| :Example: List of edges that are needed to make the graph biconnected planar. | ||
|
|
||
| **Sample graph before:** | ||
|
|
||
| .. figure:: /images/Fig6-undirected.png | ||
| :scale: 50% | ||
|
|
||
| Sample graph before | ||
|
|
||
| **Output:** | ||
|
|
||
| .. literalinclude:: makeBiconnectedPlanar.queries | ||
| :start-after: -- q1 | ||
| :end-before: -- q2 | ||
|
|
||
| **Sample graph after adding biconnecting edges:** | ||
|
|
||
| .. figure:: images/biconnected_planar_sampledata.png | ||
| :scale: 75% | ||
|
|
||
| Sample graph after adding biconnecting edges (olive = original edges, red dashed = 4 new biconnecting edges). | ||
| Note: When a graph contains multiple disconnected components, each component is processed independently. Components (2,4) and (13,14) are already biconnected (0 articulation points) and require no new edges. | ||
|
|
||
| Parameters | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| .. include:: pgRouting-concepts.rst | ||
| :start-after: only_edge_param_start | ||
| :end-before: only_edge_param_end | ||
|
|
||
| Inner Queries | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| Edges SQL | ||
| ............................................................................... | ||
|
|
||
| .. include:: pgRouting-concepts.rst | ||
| :start-after: basic_edges_sql_start | ||
| :end-before: basic_edges_sql_end | ||
|
|
||
| Result columns | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| Returns set of |result-component-make| | ||
|
|
||
| .. list-table:: | ||
| :width: 81 | ||
| :widths: auto | ||
| :header-rows: 1 | ||
|
|
||
| * - Column | ||
| - Type | ||
| - Description | ||
| * - ``seq`` | ||
| - ``BIGINT`` | ||
| - Sequential value starting from **1**. | ||
| * - ``start_vid`` | ||
| - ``BIGINT`` | ||
| - Identifier of the first end point vertex of the edge. | ||
| * - ``end_vid`` | ||
| - ``BIGINT`` | ||
| - Identifier of the second end point vertex of the edge. | ||
|
|
||
| Additional Examples | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| :Example: Biconnecting a simple 4-vertex line graph (path graph). | ||
|
|
||
| .. literalinclude:: makeBiconnectedPlanar.queries | ||
| :start-after: -- q2 | ||
| :end-before: -- q3 | ||
|
|
||
| **Sample graph before:** | ||
|
|
||
| .. figure:: images/biconnected_line_before.png | ||
| :scale: 75% | ||
|
|
||
| Sample 4-vertex line graph before biconnecting (vertices 2 and 3 are articulation points). | ||
|
|
||
| **Output:** | ||
|
|
||
| .. literalinclude:: makeBiconnectedPlanar.queries | ||
| :start-after: -- q3 | ||
| :end-before: -- q4 | ||
|
|
||
| **Sample graph after adding biconnecting edges:** | ||
|
|
||
| .. figure:: images/biconnected_line_after.png | ||
| :scale: 75% | ||
|
|
||
| Biconnected planar graph after adding new edges to eliminate articulation points without crossing. | ||
|
|
||
| See Also | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| * `Boost: make_biconnected_planar | ||
| <https://www.boost.org/doc/libs/latest/libs/graph/doc/html/graph/algorithms/planar/make_biconnected_planar.html>`__ | ||
| * :doc:`sampledata` | ||
|
|
||
| .. rubric:: Indices and tables | ||
|
|
||
| * :ref:`genindex` | ||
| * :ref:`search` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| :file: This file is part of the pgRouting project. | ||
| :copyright: Copyright (c) 2020-2026 pgRouting developers | ||
| :license: Creative Commons Attribution-Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0 | ||
|
|
||
| .. index:: Planar Family | ||
|
|
||
| | | ||
|
|
||
| Planar - Family of functions | ||
| =============================================================================== | ||
|
|
||
| .. include:: experimental.rst | ||
| :start-after: warning-begin | ||
| :end-before: end-warning | ||
|
|
||
| .. experimental-start | ||
|
|
||
| * :doc:`pgr_isPlanar` - Returns a boolean depending upon the planarity of the graph. | ||
| * :doc:`pgr_makeBiconnectedPlanar` - Returns edges to add to a planar graph to make each connected component biconnected. | ||
|
|
||
| .. experimental-end | ||
|
|
||
|
|
||
| .. toctree:: | ||
| :hidden: | ||
|
|
||
| pgr_isPlanar | ||
| pgr_makeBiconnectedPlanar | ||
|
|
||
| .. rubric:: Indices and tables | ||
|
|
||
| * :ref:`genindex` | ||
| * :ref:`search` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| set(LOCAL_FILES | ||
| boyerMyrvold | ||
| isPlanar | ||
| makeBiconnectedPlanar | ||
| ) | ||
|
|
||
| foreach (f ${LOCAL_FILES}) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* :file: This file is part of the pgRouting project. | ||
| :copyright: Copyright (c) 2020-2026 pgRouting developers | ||
| :license: Creative Commons Attribution-Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0 */ | ||
| /* -- q1 */ | ||
| SELECT * FROM pgr_makeBiconnectedPlanar( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges' | ||
| ); | ||
| /* -- q2 */ | ||
| CREATE TABLE example_edges_bi ( | ||
| id SERIAL PRIMARY KEY, | ||
| source INTEGER, | ||
| target INTEGER, | ||
| cost DOUBLE PRECISION, | ||
| reverse_cost DOUBLE PRECISION | ||
| ); | ||
| INSERT INTO example_edges_bi (source, target, cost, reverse_cost) VALUES | ||
| (1, 2, 1, 1), | ||
| (2, 3, 1, 1), | ||
| (3, 4, 1, 1); | ||
|
|
||
| /* -- q3 */ | ||
| SELECT * FROM pgr_makeBiconnectedPlanar( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM example_edges_bi' | ||
| ); | ||
| /* -- q4 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| BEGIN; | ||
| BEGIN | ||
| SET client_min_messages TO NOTICE; | ||
| SET | ||
| /* :file: This file is part of the pgRouting project. | ||
| :copyright: Copyright (c) 2020-2026 pgRouting developers | ||
| :license: Creative Commons Attribution-Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0 */ | ||
| /* -- q1 */ | ||
| SELECT * FROM pgr_makeBiconnectedPlanar( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges' | ||
| ); | ||
| seq | start_vid | end_vid | ||
| -----+-----------+--------- | ||
| 1 | 1 | 7 | ||
| 2 | 3 | 11 | ||
| 3 | 5 | 10 | ||
| 4 | 7 | 9 | ||
| (4 rows) | ||
|
|
||
| /* -- q2 */ | ||
| CREATE TABLE example_edges_bi ( | ||
| id SERIAL PRIMARY KEY, | ||
| source INTEGER, | ||
| target INTEGER, | ||
| cost DOUBLE PRECISION, | ||
| reverse_cost DOUBLE PRECISION | ||
| ); | ||
| CREATE TABLE | ||
| INSERT INTO example_edges_bi (source, target, cost, reverse_cost) VALUES | ||
| (1, 2, 1, 1), | ||
| (2, 3, 1, 1), | ||
| (3, 4, 1, 1); | ||
| INSERT 0 3 | ||
| /* -- q3 */ | ||
| SELECT * FROM pgr_makeBiconnectedPlanar( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM example_edges_bi' | ||
| ); | ||
| seq | start_vid | end_vid | ||
| -----+-----------+--------- | ||
| 1 | 1 | 3 | ||
| 2 | 2 | 4 | ||
| (2 rows) | ||
|
|
||
| /* -- q4 */ | ||
| ROLLBACK; | ||
| ROLLBACK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| 'any' => { | ||
| 'files' => [qw( | ||
| isPlanar.pg | ||
| makeBiconnectedPlanar.pg | ||
| )] | ||
| }, | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.