-
-
Notifications
You must be signed in to change notification settings - Fork 395
New function : pgr maximal planar #3134
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
new-function-pgr-maximal-planar
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
3229d86
[makeMaximalPlanar/sql] Adding SQL code for pgr_makeMaximalPlanar
Mohit242-bit c046059
[makeMaximalPlanar/C/C++] Adding C/C++ code for pgr_makeMaximalPlanar
Mohit242-bit 303fd41
[makeMaximalPlanar/pgtap] Adding test files for pgr_makeMaximalPlanar
Mohit242-bit 9e888db
[makeMaximalPlanar/docqueries] Adding test documentation examples cod…
Mohit242-bit 310edd9
[makeMaximalPlanar/doc] Adding documentation for pgr_makeMaximalPlanar
Mohit242-bit 444c6df
Updating release notes and NEWS about the new function pgr_makeMaxima…
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,163 @@ | ||
| :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_makeMaximalPlanar - Experimental | ||
| single: makeMaximalPlanar - Experimental on v4.1 | ||
|
|
||
| | | ||
|
|
||
| ``pgr_makeMaximalPlanar`` - Experimental | ||
| =============================================================================== | ||
|
|
||
| ``pgr_makeMaximalPlanar`` — Returns the set of edges needed to make a planar graph maximal planar. | ||
|
|
||
| .. include:: experimental.rst | ||
| :start-after: warning-begin | ||
| :end-before: end-warning | ||
|
|
||
| .. rubric:: Availability | ||
|
|
||
| .. rubric:: Version 4.1.0 | ||
|
|
||
| * New experimental function. | ||
|
|
||
|
|
||
| Description | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| ``pgr_makeMaximalPlanar`` identifies the missing edges that need to be added to | ||
| the connected components of a planar graph to make each eligible component maximal planar. | ||
|
|
||
| A planar graph is considered **maximal planar** (or fully triangulated) if no additional | ||
| edges can be added to it without violating its planarity. In a maximal planar graph, | ||
| every face (including the outer face) is a triangle. | ||
|
|
||
| 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 triangulate the eligible components of the graph and make them maximal planar. | ||
| * The augmentation applies independently to eligible components (components with 3 or more vertices). Components with fewer than 3 vertices produce no added edges. | ||
| * 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_makeMaximalPlanar(`Edges SQL`_) | ||
|
|
||
| | Returns set of |result-component-make| | ||
| | OR EMPTY SET | ||
|
|
||
| :Example: List of edges that are needed to make the sample graph maximal planar. | ||
|
|
||
| **Sample graph before:** | ||
|
|
||
| .. figure:: /images/Fig6-undirected.png | ||
| :scale: 50% | ||
|
|
||
| Sample graph before | ||
|
|
||
| **Output:** | ||
|
|
||
| .. literalinclude:: makeMaximalPlanar.queries | ||
| :start-after: -- q1 | ||
| :end-before: -- q2 | ||
|
|
||
| **Sample graph after adding triangulation edges:** | ||
|
|
||
| .. figure:: images/maximal_planar_sampledata.png | ||
| :scale: 75% | ||
|
|
||
| Sample graph after adding triangulation edges (olive = original edges, red dashed = 17 new triangulation edges). | ||
| Note: When a graph contains multiple disconnected components, each component is processed independently. Components (2,4) and (13,14) have < 3 vertices and cannot be triangulated; the 13-vertex component is triangulated with 17 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: Triangulating a simple 5-cycle ring graph. | ||
|
|
||
| .. literalinclude:: makeMaximalPlanar.queries | ||
| :start-after: -- q2 | ||
| :end-before: -- q3 | ||
|
|
||
| **Sample graph before:** | ||
|
|
||
| .. figure:: images/maximal_planar_5cycle_before.png | ||
| :scale: 75% | ||
|
|
||
| Sample 5-cycle ring graph before triangulation. | ||
|
|
||
| **Output:** | ||
|
|
||
| .. literalinclude:: makeMaximalPlanar.queries | ||
| :start-after: -- q3 | ||
| :end-before: -- q4 | ||
|
|
||
| **Sample graph after adding triangulation edges:** | ||
|
|
||
| .. figure:: images/maximal_planar_5cycle.png | ||
| :scale: 75% | ||
|
|
||
| Maximal planar triangulation of a simple 5-cycle ring graph (4 red dashed triangulation edges added). | ||
|
|
||
| See Also | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| * `Boost: make_maximal_planar | ||
| <https://www.boost.org/doc/libs/latest/libs/graph/doc/html/graph/algorithms/planar/make_maximal_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_makeMaximalPlanar` - Returns edges to add to a planar graph to make its eligible components maximal planar. | ||
|
|
||
| .. experimental-end | ||
|
|
||
|
|
||
| .. toctree:: | ||
| :hidden: | ||
|
|
||
| pgr_isPlanar | ||
| pgr_makeMaximalPlanar | ||
|
|
||
| .. 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 | ||
| makeMaximalPlanar | ||
| ) | ||
|
|
||
| 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,27 @@ | ||
| /* :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_makeMaximalPlanar( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges' | ||
| ); | ||
| /* -- q2 */ | ||
| CREATE TABLE example_edges1 ( | ||
| id SERIAL PRIMARY KEY, | ||
| source INTEGER, | ||
| target INTEGER, | ||
| cost DOUBLE PRECISION, | ||
| reverse_cost DOUBLE PRECISION | ||
| ); | ||
| INSERT INTO example_edges1 (source, target, cost, reverse_cost) VALUES | ||
| (1, 2, 1, 1), | ||
| (2, 3, 1, 1), | ||
| (3, 4, 1, 1), | ||
| (4, 5, 1, 1), | ||
| (5, 1, 1, 1); | ||
|
|
||
| /* -- q3 */ | ||
| SELECT * FROM pgr_makeMaximalPlanar( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM example_edges1' | ||
| ); | ||
| /* -- q4 */ |
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.