Skip to content
Merged
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
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ Summary of changes by function

* Combinations signature promoted to official.

* pgr_sloanOrdering

* New experimental function.

* pgr_sequentialVertexColoring

* Output columns standardized to ``(node, color)``
Expand Down Expand Up @@ -310,6 +314,7 @@ New experimental functions
* Ordering

* [#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

Expand Down
4 changes: 2 additions & 2 deletions doc/_static/page_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function createInfo(file, newat, altnames = '', removedat = '') {
this.removedat = removedat;
}

const versionsArr = ['3.8','3.7', '3.6', '3.5', '3.4', '3.3', '3.2', '3.1', '3.0'];
const versionsArr = ['4.0', '3.8','3.7', '3.6', '3.5', '3.4', '3.3', '3.2', '3.1', '3.0'];
var unsuportedArr = ['2.6', '2.5', '2.4', '2.3', '2.2', '2.1', '2.0'];
var titles = [
{k: 'en', v: ['Supported versions', 'Unsupported versions']},
Expand All @@ -15,7 +15,7 @@ var titles = [


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

{v: '3.8', pages: ['pgr_contractionDeadEnd', 'pgr_contractionLinear', 'pgr_separateCrossing',
'pgr_separateTouching']},
Expand Down
1 change: 1 addition & 0 deletions doc/ordering/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SET(LOCAL_FILES
ordering-family.rst
pgr_cuthillMckeeOrdering.rst
pgr_topologicalSort.rst
pgr_sloanOrdering.rst
pgr_kingOrdering.rst
)

Expand Down
5 changes: 3 additions & 2 deletions doc/ordering/ordering-family.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Ordering - Family of functions
* :doc:`pgr_cuthillMckeeOrdering` - Return reverse Cuthill-McKee ordering of an undirected graph.
* :doc:`pgr_topologicalSort` - Linear ordering of the vertices for directed
acyclic graph.
* :doc:`pgr_kingOrdering` - Returns the King ordering of an undirected graphs
acyclic graph.
* :doc:`pgr_sloanOrdering` - Returns the sloan ordering of an undirected graph.
* :doc:`pgr_kingOrdering` - Returns the King ordering of an undirected graph.

.. official-end

Expand All @@ -34,6 +34,7 @@ Ordering - Family of functions

pgr_cuthillMckeeOrdering
pgr_topologicalSort
pgr_sloanOrdering
pgr_kingOrdering

See Also
Expand Down
149 changes: 149 additions & 0 deletions doc/ordering/pgr_sloanOrdering.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
..
****************************************************************************
pgRouting Manual
Copyright(c) pgRouting Contributors

This documentation is licensed under a Creative Commons Attribution-Share

Alike 3.0 License: http://creativecommons.org/licenses/by-sa/3.0/
****************************************************************************

.. index::
single: Ordering Family ; pgr_sloanOrdering
single: pgr_sloanOrdering - Experimental on v4.0

|

``pgr_sloanOrdering`` - Experimental
===============================================================================

``pgr_sloanOrdering`` — Returns the sloan ordering of an undirected
graph

.. include:: experimental.rst
:start-after: warning-begin
:end-before: end-warning

.. rubric:: Availability

.. rubric:: Version 4.0.0

* New experimental function.


Description
-------------------------------------------------------------------------------

The Sloan ordering algorithm reorders the vertices of a graph to reduce
bandwidth, profile, and wavefront properties, which is particularly useful for
sparse matrix computations and finite element analysis.

* Finds a pseudoperipheral vertex pair to determine good starting points
* Uses a priority-based algorithm that balances vertex degree and distance from the start vertex.
* Aims to mininimize bandwidth (maximum difference between connected vertex indices.
* The implementation is for undirected graphs
* Typically produces better orderings than simple breadth-first approaches.
* Run time is 0.115846 seconds.

|Boost| Boost Graph inside

Signatures
------------------------------------------------------------------------------
..rubric::Summary

.. index::
single: sloanOrdering - Experimental on v4.0

.. admonition:: \ \
:class: signatures

| pgr_sloanOrdering(`Edges SQL`_)

| Returns set of |result_node_order|
| OR EMPTY SET

:Example : Sloan ordering without specifying start vertex

.. literalinclude:: sloanOrdering.queries
:start-after: -- q1
:end-before: -- q2

.. Parameters, Inner Queries & result columns

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, node)``

=============== =========== ======================================
Column Type Description
=============== =========== ======================================
``seq`` ``BIGINT`` Sequence of the order starting from 1.
``node`` ``BIGINT`` New sloan ordering order.
=============== =========== ======================================

Additional Examples

:Example: Sloan ordering of Original graph from Boost example (vertices 0-9).

..graphviz::

graph G{
node[shape=circle, style=filled, fillcolor=lightblue, color=black, fontcolor=black, fontsize=12];
edge[color=black, penwidth=1.5];

0 -- 3;
0 -- 5;
1 -- 2;
1 -- 4;
1 -- 6;
1 -- 9;
2 -- 3;
2 -- 4;
3 -- 5;
3 -- 8;
4 -- 6;
5 -- 6;
5 -- 7;
6 -- 7;

{rank=same; 0; 8;}
{rank=same; 3; 5; 7;}
{rank=same; 2; 4; 6;}
{rank=same; 1; 9;}

}

..literalinclude::sloanOrdering.queries
:start-after: --q3
:end-before: --q4


See Also
-------------------------------------------------------------------------------

* :doc:`sampledata`
* `Boost: Sloan Ordering
<https://www.boost.org/libs/graph/doc/sloan_ordering.html>`__

.. rubric:: Indices and tables

* :ref:`genindex`
* :ref:`search`
4 changes: 3 additions & 1 deletion doc/src/pgRouting-introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ This Release Contributors
Individuals in this release v4.0.0 (in alphabetical order)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Fan Wu
Bipasha Gayary,
Fan Wu,
Regina Obe,
Saloni kumari,
Vicky Vergara
Expand Down Expand Up @@ -111,6 +112,7 @@ Aryan Gupta,
Ashraf Hossain,
Ashish Kumar,
Aurélie Bousquet,
Bipasha Gayary,
Cayetano Benavent,
Christian Gonzalez,
Daniel Kastl,
Expand Down
7 changes: 7 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ Summary of changes by function
:start-after: Version 4.0.0
:end-before: .. rubric

* pgr_sloanOrdering

.. include:: pgr_sloanOrdering.rst
:start-after: Version 4.0.0
:end-before: Description

* pgr_sequentialVertexColoring

.. include:: pgr_sequentialVertexColoring.rst
Expand Down Expand Up @@ -363,6 +369,7 @@ New experimental functions
* Ordering

* :issue:`2954`: pgr_kingOrdering
* :issue:`2955`: pgr_sloanOrdering

SQL signatures and output standardization
...............................................................................
Expand Down
1 change: 1 addition & 0 deletions docqueries/ordering/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
SET(LOCAL_FILES
cuthillMckeeOrdering
topologicalSort
sloanOrdering
kingOrdering
)

Expand Down
46 changes: 46 additions & 0 deletions docqueries/ordering/sloanOrdering.pg
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- CopyRight(c) pgRouting developers
-- Creative Commons Attribution-Share Alike 3.0 License : https://creativecommons.org/licenses/by-sa/3.0/
/* -- q1 */
SELECT * FROM pgr_sloanOrdering(
'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
);
/* --q3 */
INSERT INTO example_edges1 (source, target, cost, reverse_cost) VALUES
(4, 7, 1, 1),
(7, 4, 1, 1),
(7, 9, 1, 1),
(9, 7, 1, 1),
(7, 0, 1, 1),
(0, 7, 1, 1),
(0, 2, 1, 1),
(2, 0, 1, 1),
(2, 5, 1, 1),
(5, 2, 1, 1),
(5, 9, 1, 1),
(9, 5, 1, 1),
(9, 8, 1, 1),
(8, 9, 1, 1),
(9, 1, 1, 1),
(1, 9, 1, 1),
(5, 1, 1, 1),
(1, 5, 1, 1),
(9, 6, 1, 1),
(6, 9, 1, 1),
(6, 3, 1, 1),
(3, 6, 1, 1),
(1, 3, 1, 1),
(3, 1, 1, 1);
/* --q4 */
SELECT * FROM pgr_sloanOrdering(
'SELECT id, source, target, cost, reverse_cost FROM example_edges1'
);
/* --q5 */
86 changes: 86 additions & 0 deletions docqueries/ordering/sloanOrdering.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
BEGIN;
BEGIN
SET client_min_messages TO NOTICE;
SET
/* -- q1 */
SELECT * FROM pgr_sloanOrdering(
'SELECT id, source, target, cost, reverse_cost FROM edges'
);
seq | node
-----+------
1 | 1
2 | 3
3 | 8
4 | 9
5 | 12
6 | 7
7 | 5
8 | 17
9 | 6
10 | 11
11 | 16
12 | 10
13 | 15
14 | 1
15 | 1
16 | 1
17 | 1
(17 rows)

/* -- q2 */
CREATE TABLE example_edges1 (
id SERIAL PRIMARY KEY,
source INTEGER,
target INTEGER,
cost DOUBLE PRECISION,
reverse_cost DOUBLE PRECISION
);
CREATE TABLE
/* --q3 */
INSERT INTO example_edges1 (source, target, cost, reverse_cost) VALUES
(4, 7, 1, 1),
(7, 4, 1, 1),
(7, 9, 1, 1),
(9, 7, 1, 1),
(7, 0, 1, 1),
(0, 7, 1, 1),
(0, 2, 1, 1),
(2, 0, 1, 1),
(2, 5, 1, 1),
(5, 2, 1, 1),
(5, 9, 1, 1),
(9, 5, 1, 1),
(9, 8, 1, 1),
(8, 9, 1, 1),
(9, 1, 1, 1),
(1, 9, 1, 1),
(5, 1, 1, 1),
(1, 5, 1, 1),
(9, 6, 1, 1),
(6, 9, 1, 1),
(6, 3, 1, 1),
(3, 6, 1, 1),
(1, 3, 1, 1),
(3, 1, 1, 1);
INSERT 0 24
/* --q4 */
SELECT * FROM pgr_sloanOrdering(
'SELECT id, source, target, cost, reverse_cost FROM example_edges1'
);
seq | node
-----+------
1 | 4
2 | 0
3 | 2
4 | 7
5 | 8
6 | 5
7 | 9
8 | 3
9 | 1
10 | 6
(10 rows)

/* --q5 */
ROLLBACK;
ROLLBACK
Loading
Loading