-
-
Notifications
You must be signed in to change notification settings - Fork 392
Fix: Restore pgr_boyerMyrvold to build and fix compilation bugs #3078
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
Draft
Mohit242-bit
wants to merge
9
commits into
pgRouting:develop
Choose a base branch
from
Mohit242-bit:fix/clean-restore-boyerMyrvold
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.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a677916
Fix: Restore pgr_boyerMyrvold to build and fix compilation bugs
Mohit242-bit 9fda651
Fix: resolve CI issues - update signature file, restore result file, …
Mohit242-bit 8972614
Regenerate boyerMyrvold.result against current sample data
Mohit242-bit b0a3da4
Update min_version to 4.1.0 for boyerMyrvold tests
Mohit242-bit e25f0cc
Add documentation, update SQL version to v4.1, register in experimental
Mohit242-bit c15d993
Update locale: commit 1af6c0232
github-actions[bot] a47330d
Fix: remove version from index entry, deduplicate description text
Mohit242-bit d310928
Fix:
Mohit242-bit d55f66a
Update locale: commit d3109289c
github-actions[bot] 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| :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_boyerMyrvold | ||
| single: boyerMyrvold | ||
|
|
||
| | | ||
| ``pgr_boyerMyrvold`` - Experimental | ||
| =============================================================================== | ||
|
|
||
| ``pgr_boyerMyrvold`` — Returns the planar embedding of a graph, if the graph is | ||
| planar. | ||
|
|
||
| .. include:: experimental.rst | ||
| :start-after: warning-begin | ||
| :end-before: end-warning | ||
|
|
||
| .. rubric:: Availability | ||
|
|
||
| * Version 4.1.0 | ||
|
|
||
| * New experimental function. | ||
|
|
||
|
|
||
| Description | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| A planar embedding of a graph is a mapping of the graph onto a plane such that | ||
| no two edges cross. Given a graph, the Boyer-Myrvold planarity testing algorithm | ||
| can produce a planar embedding if the graph is planar, or identify a Kuratowski | ||
| subgraph (a subdivision of :math:`K_5` or :math:`K_{3,3}`) if it is not. | ||
|
|
||
| The main characteristics are: | ||
|
|
||
| * This implementation uses the Boyer-Myrvold Planarity Testing. | ||
| * Returns the edges of the planar embedding when the graph is planar. | ||
| * If the graph is not planar, it returns an empty set. | ||
| * Applicable only for **undirected** graphs. | ||
| * The algorithm does not consider traversal costs in the calculations. | ||
| * Running time: :math:`O(|V|)` | ||
|
|
||
| |Boost| Boost Graph Inside | ||
|
|
||
| Signatures | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| .. rubric:: Summary | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is only one function so no summary word is needed |
||
|
|
||
| .. admonition:: \ \ | ||
| :class: signatures | ||
|
|
||
| | pgr_boyerMyrvold(`Edges SQL`) | ||
| | RETURNS SETOF |result-edge| | ||
| :Example: Get the planar embedding of the graph | ||
|
|
||
| .. literalinclude:: boyerMyrvold.queries | ||
| :start-after: -- q1 | ||
| :end-before: -- q2 | ||
|
|
||
| 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 ``(seq, source, target, cost)`` | ||
|
|
||
| ============== =========== ========================================== | ||
| Column Type Description | ||
| ============== =========== ========================================== | ||
| ``seq`` ``BIGINT`` Sequential value starting from :math:`1`. | ||
| ``source`` ``BIGINT`` Identifier of the source vertex. | ||
| ``target`` ``BIGINT`` Identifier of the target vertex. | ||
| ``cost`` ``FLOAT`` Cost of the edge. | ||
| ============== =========== ========================================== | ||
|
|
||
| Additional Examples | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Making a non planar graph | ||
| ............................................................................... | ||
|
|
||
| Adding extra edges to create a :math:`K_5` subgraph. | ||
|
|
||
| .. literalinclude:: boyerMyrvold.queries | ||
| :start-after: -- q2 | ||
| :end-before: -- q3 | ||
|
|
||
| The graph is no longer planar, so the result is empty: | ||
|
|
||
| .. literalinclude:: boyerMyrvold.queries | ||
| :start-after: -- q3 | ||
| :end-before: -- q4 | ||
|
|
||
| Using with pgr_connectedComponents | ||
| ............................................................................... | ||
|
|
||
| .. literalinclude:: boyerMyrvold.queries | ||
| :start-after: -- q4 | ||
| :end-before: -- q5 | ||
|
|
||
| See Also | ||
| ------------------------------------------------------------------------------- | ||
|
|
||
| * :doc:`pgr_isPlanar` | ||
| * :doc:`sampledata` | ||
| * `Boost: Boyer Myrvold | ||
| <https://www.boost.org/libs/graph/doc/boyer_myrvold.html>`__ | ||
|
|
||
| .. 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,66 +5,100 @@ SET | |
| /* :file: This file is part of the pgRouting project. | ||
| :copyright: Copyright (c) 2018-2026 pgRouting developers | ||
| :license: Creative Commons Attribution-Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0 */ | ||
| -- q1 | ||
| /* -- q1 */ | ||
| SELECT * FROM pgr_boyerMyrvold( | ||
| 'SELECT id, source, target, cost, reverse_cost | ||
| FROM edge_table' | ||
| FROM edges' | ||
| ); | ||
| seq | source | target | cost | ||
| -----+--------+--------+------ | ||
| 1 | 1 | 2 | 1 | ||
| 2 | 3 | 2 | 1 | ||
| 3 | 4 | 3 | 1 | ||
| 4 | 2 | 5 | 1 | ||
| 5 | 3 | 6 | 1 | ||
| 6 | 7 | 8 | 1 | ||
| 7 | 8 | 5 | 1 | ||
| 8 | 5 | 6 | 1 | ||
| 9 | 6 | 9 | 1 | ||
| 10 | 5 | 10 | 1 | ||
| 11 | 6 | 11 | 1 | ||
| 12 | 10 | 11 | 1 | ||
| 13 | 11 | 12 | 1 | ||
| 14 | 10 | 13 | 1 | ||
| 15 | 9 | 12 | 1 | ||
| 16 | 4 | 9 | 1 | ||
| 17 | 14 | 15 | 1 | ||
| 18 | 16 | 17 | 1 | ||
| 1 | 1 | 3 | 1 | ||
| 2 | 3 | 7 | 1 | ||
| 3 | 6 | 7 | 1 | ||
| 4 | 10 | 11 | 1 | ||
| 5 | 7 | 11 | 1 | ||
| 6 | 8 | 12 | 1 | ||
| 7 | 11 | 12 | 1 | ||
| 8 | 7 | 8 | 1 | ||
| 9 | 2 | 4 | 1 | ||
| 10 | 8 | 9 | 1 | ||
| 11 | 13 | 14 | 1 | ||
| 12 | 12 | 17 | 1 | ||
| 13 | 16 | 17 | 1 | ||
| 14 | 15 | 16 | 1 | ||
| 15 | 11 | 16 | 1 | ||
| 16 | 15 | 10 | 1 | ||
| 17 | 5 | 6 | 1 | ||
| 18 | 10 | 6 | 1 | ||
| (18 rows) | ||
|
|
||
| -- q2 | ||
| INSERT INTO edge_table (source, target, cost, reverse_cost) VALUES | ||
| /* -- q2 */ | ||
| INSERT INTO edges (source, target, cost, reverse_cost) VALUES | ||
| (1,3,1,-1),(1,4,1,-1),(1,5,1,-1),(2,4,1,-1),(2,5,1,-1),(3,5,1,-1),(4,5,1,-1); | ||
| INSERT 0 7 | ||
| -- q3 | ||
| /* -- q3 */ | ||
| SELECT * FROM pgr_boyerMyrvold( | ||
| 'SELECT id, source, target, cost, reverse_cost | ||
| FROM edge_table' | ||
| FROM edges' | ||
| ); | ||
| seq | source | target | cost | ||
| -----+--------+--------+------ | ||
| (0 rows) | ||
| 1 | 1 | 3 | 1 | ||
| 2 | 1 | 4 | 1 | ||
| 3 | 1 | 5 | 1 | ||
| 4 | 2 | 4 | 1 | ||
| 5 | 2 | 5 | 1 | ||
| 6 | 3 | 5 | 1 | ||
| 7 | 4 | 5 | 1 | ||
| 8 | 1 | 3 | 1 | ||
| 9 | 3 | 7 | 1 | ||
| 10 | 6 | 7 | 1 | ||
| 11 | 10 | 11 | 1 | ||
| 12 | 7 | 11 | 1 | ||
| 13 | 8 | 12 | 1 | ||
| 14 | 11 | 12 | 1 | ||
| 15 | 7 | 8 | 1 | ||
| 16 | 2 | 4 | 1 | ||
| 17 | 8 | 9 | 1 | ||
| 18 | 13 | 14 | 1 | ||
| 19 | 12 | 17 | 1 | ||
| 20 | 16 | 17 | 1 | ||
| 21 | 15 | 16 | 1 | ||
| 22 | 11 | 16 | 1 | ||
| 23 | 15 | 10 | 1 | ||
| 24 | 5 | 6 | 1 | ||
| 25 | 10 | 6 | 1 | ||
| (25 rows) | ||
|
|
||
| -- q4 | ||
| /* -- q4 */ | ||
| SELECT * FROM pgr_boyerMyrvold( | ||
| $$ | ||
| SELECT id, source, target, cost, reverse_cost FROM edge_table | ||
| SELECT id, source, target, cost, reverse_cost FROM edges | ||
| where source = any (ARRAY(SELECT node FROM pgr_connectedComponents( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edge_table ') | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges ') | ||
| WHERE component = 14) | ||
| ) | ||
| OR | ||
| target = any (ARRAY(SELECT node FROM pgr_connectedComponents( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edge_table ') | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges ') | ||
| WHERE component = 14) | ||
| ) | ||
| $$ | ||
| ); | ||
| seq | source | target | cost | ||
| -----+--------+--------+------ | ||
| 1 | 14 | 15 | 1 | ||
| (1 row) | ||
| ERROR: No edges found | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm, the inner query is not returning edges but this one works: |
||
| HINT: | ||
| SELECT id, source, target, cost, reverse_cost FROM edges | ||
| where source = any (ARRAY(SELECT node FROM pgr_connectedComponents( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges ') | ||
| WHERE component = 14) | ||
| ) | ||
| OR | ||
| target = any (ARRAY(SELECT node FROM pgr_connectedComponents( | ||
| 'SELECT id, source, target, cost, reverse_cost FROM edges ') | ||
| WHERE component = 14) | ||
| ) | ||
|
|
||
| -- q5 | ||
| CONTEXT: SQL function "pgr_boyermyrvold" statement 1 | ||
| /* -- q5 */ | ||
| 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 |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| %main::tests = ( | ||
| 'any' => { | ||
| 'files' => [qw( | ||
| boyerMyrvold.pg | ||
| isPlanar.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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the file is originally from 2026 so