Skip to content
Open
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
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@ To see all issues & pull requests closed by this release see the
* [#3101](https://github.com/pgRouting/pgrouting/issues/3101): pgr_edgeColoring not building graph correctly


**New experimental functions.**

* Planar

* pgr_makeMaximalPlanar

**Summary of changes by function**

* pgr_edgeColoring

* Fix the way it builds the graph

* pgr_makeMaximalPlanar

* New experimental function.

## pgRouting 4.0


Expand Down Expand Up @@ -272,6 +282,7 @@ Summary of changes by function

* All signatures promoted to official.


* pgr_maxCardinalityMatch

.. Breaking change
Expand Down Expand Up @@ -463,6 +474,7 @@ New experimental functions.
* [#2954](https://github.com/pgRouting/pgrouting/issues/2954): pgr_kingOrdering
* [#2955](https://github.com/pgRouting/pgrouting/issues/2955): pgr_sloanOrdering


SQL signatures and output standardization

[#2904](https://github.com/pgRouting/pgrouting/issues/2904): Standardize output columns of functions with different output
Expand Down
2 changes: 2 additions & 0 deletions doc/_static/page_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var titles = [


var newpages = [
{v: '4.1', pages: ['pgr_makeMaximalPlanar']},

{v: '4.0', pages: ['pgr_bandwidth', 'pgr_kingOrdering', 'pgr_sloanOrdering']},

{v: '3.8', pages: ['pgr_contractionDeadEnd', 'pgr_contractionLinear', 'pgr_separateCrossing',
Expand Down
2 changes: 2 additions & 0 deletions doc/planar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License: GPL-2 See https://github.com/pgRouting/pgrouting/blob/main/LICENSE

set(LOCAL_FILES
planar-family.rst
pgr_isPlanar.rst
pgr_makeMaximalPlanar.rst
)

foreach (f ${LOCAL_FILES})
Expand Down
3 changes: 3 additions & 0 deletions doc/planar/images/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# License: GPL-2 See https://github.com/pgRouting/pgrouting/blob/main/LICENSE
set(LOCAL_FILES
nonPlanar.png
maximal_planar_sampledata.png
maximal_planar_5cycle.png
maximal_planar_5cycle_before.png
)

foreach (f ${LOCAL_FILES})
Expand Down
Binary file added doc/planar/images/maximal_planar_5cycle.png
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.
Binary file added doc/planar/images/maximal_planar_sampledata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
163 changes: 163 additions & 0 deletions doc/planar/pgr_makeMaximalPlanar.rst
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.
Comment thread
Mohit242-bit marked this conversation as resolved.

|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`
33 changes: 33 additions & 0 deletions doc/planar/planar-family.rst
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`
14 changes: 7 additions & 7 deletions doc/src/experimental.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,20 @@ Experimental Functions
:start-after: experimental-start
:end-before: experimental-end

:doc:`planar-family`

.. include:: planar-family.rst
:start-after: experimental-start
:end-before: experimental-end

.. toctree::
:hidden:

chinesePostmanProblem-family
transformation-family
components-family
ordering-family
planar-family

.. rubric:: categories

Expand Down Expand Up @@ -127,14 +134,7 @@ Experimental Functions
pgr_dagShortestPath
pgr_edwardMoore

.. rubric:: Planar Family

- :doc:`pgr_isPlanar`

.. toctree::
:hidden:

pgr_isPlanar

.. rubric:: Miscellaneous Algorithms

Expand Down
14 changes: 14 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ To see all issues & pull requests closed by this release see the
* :issue:`3101`: pgr_edgeColoring not building graph correctly


.. rubric:: New experimental functions.

* Planar

* pgr_makeMaximalPlanar

.. rubric:: Summary of changes by function

* pgr_edgeColoring
Expand All @@ -68,6 +74,12 @@ To see all issues & pull requests closed by this release see the
:start-after: Version 4.1.0
:end-before: .. rubric

* pgr_makeMaximalPlanar

.. include:: pgr_makeMaximalPlanar.rst
:start-after: Version 4.1.0
:end-before: Description

pgRouting 4.0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Expand Down Expand Up @@ -358,6 +370,7 @@ Summary of changes by function
:start-after: Version 4.0.0
:end-before: .. rubric


* pgr_maxCardinalityMatch

.. include:: pgr_maxCardinalityMatch.rst
Expand Down Expand Up @@ -525,6 +538,7 @@ New experimental functions.
* :issue:`2954`: pgr_kingOrdering
* :issue:`2955`: pgr_sloanOrdering


SQL signatures and output standardization
...............................................................................

Expand Down
1 change: 1 addition & 0 deletions docqueries/planar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
set(LOCAL_FILES
boyerMyrvold
isPlanar
makeMaximalPlanar
)

foreach (f ${LOCAL_FILES})
Expand Down
27 changes: 27 additions & 0 deletions docqueries/planar/makeMaximalPlanar.pg
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 */
Loading
Loading