pgr_cuthillMckeeOrdering - Experimental

pgr_cuthillMckeeOrdering — Returns the reverse Cuthill-Mckee ordering of an undirected graphs

_images/boost-inside.jpeg

Boost Graph Inside

Warning

Possible server crash

  • These functions might create a server crash

Warning

Experimental functions

  • They are not officially of the current release.

  • They likely will not be officially be part of the next release:

    • The functions might not make use of ANY-INTEGER and ANY-NUMERICAL

    • Name might change.

    • Signature might change.

    • Functionality might change.

    • pgTap tests might be missing.

    • Might need c/c++ coding.

    • May lack documentation.

    • Documentation if any might need to be rewritten.

    • Documentation examples might need to be automatically generated.

    • Might need a lot of feedback from the comunity.

    • Might depend on a proposed function of pgRouting

    • Might depend on a deprecated function of pgRouting

Availability

  • Version 3.4.0

    • New experimental function

Description

In numerical linear algebra, the Cuthill-McKee algorithm (CM), named after Elizabeth Cuthill and James McKee, is an algorithm to permute a sparse matrix that has a symmetric sparsity pattern into a band matrix form with a small bandwidth.

The vertices are basically assigned a breadth-first search order, except that at each step, the adjacent vertices are placed in the queue in order of increasing degree.

The main Characteristics are:

  • The implementation is for undirected graphs.

  • The bandwidth minimization problems are considered NP-complete problems.

  • The running time complexity is: \(O(m log(m)|V|)\)

    • where \(|V|\) is the number of vertices,

    • \(m\) is the maximum degree of the vertices in the graph.

Signatures

pgr_cuthillMckeeOrdering(Edges SQL)
RETURNS SET OF (seq, node)
OR EMPTY SET
Example:

Graph ordering of pgRouting Sample Data

SELECT * FROM pgr_cuthillMckeeOrdering(
  'SELECT id, source, target, cost, reverse_cost FROM edges'
  );
 seq | node
-----+------
   1 |   13
   2 |   14
   3 |    2
   4 |    4
   5 |    1
   6 |    9
   7 |    3
   8 |    8
   9 |    5
  10 |    7
  11 |   12
  12 |    6
  13 |   11
  14 |   17
  15 |   10
  16 |   16
  17 |   15
(17 rows)

Parameters

Parameter

Type

Description

Edges SQL

TEXT

Edges SQL as described below.

Inner Queries

Edges SQL

Column

Type

Default

Description

id

ANY-INTEGER

Identifier of the edge.

source

ANY-INTEGER

Identifier of the first end point vertex of the edge.

target

ANY-INTEGER

Identifier of the second end point vertex of the edge.

cost

ANY-NUMERICAL

Weight of the edge (source, target)

reverse_cost

ANY-NUMERICAL

-1

Weight of the edge (target, source)

  • When negative: edge (target, source) does not exist, therefore it’s not part of the graph.

Where:

ANY-INTEGER:

SMALLINT, INTEGER, BIGINT

ANY-NUMERICAL:

SMALLINT, INTEGER, BIGINT, REAL, FLOAT

Result Columns

Returns SET OF (seq, node)

Column

Type

Description

seq

BIGINT

Sequence of the order starting from 1.

node

BIGINT

New ordering in reverse order.

See Also

Indices and tables