pgr_biconnectedComponents

pgr_biconnectedComponents — Return the biconnected components of an undirected graph. In particular, the algorithm implemented by Boost.Graph.

_images/boost-inside.jpeg

Boost Graph Inside

Availability

  • Version 3.0.0
    • Return columns change: n_seq is removed
    • Official function
  • Version 2.5.0
    • New experimental function

Support

  • Supported versions: current(3.0)
  • Unsupported versions: 2.6 2.5

Description

The biconnected components of an undirected graph are the maximal subsets of vertices such that the removal of a vertex from particular component will not disconnect the component. Unlike connected components, vertices may belong to multiple biconnected components. Vertices can be present in multiple biconnected components, but each edge can only be contained in a single biconnected component.

The main characteristics are:

  • The signature is for an undirected graph.
  • Components are described by edges.
  • The returned values are ordered:
    • component ascending.
    • edge ascending.
  • Running time: \(O(V + E)\)

Signatures

pgr_biconnectedComponents(Edges SQL)

RETURNS SET OF (seq, component, edge)
OR EMPTY SET
Example:The biconnected components of the graph
SELECT * FROM pgr_biconnectedComponents(
    'SELECT id, source, target, cost, reverse_cost FROM edge_table'
);
 seq | component | edge
-----+-----------+------
   1 |         1 |    1
   2 |         2 |    2
   3 |         2 |    3
   4 |         2 |    4
   5 |         2 |    5
   6 |         2 |    8
   7 |         2 |    9
   8 |         2 |   10
   9 |         2 |   11
  10 |         2 |   12
  11 |         2 |   13
  12 |         2 |   15
  13 |         2 |   16
  14 |         6 |    6
  15 |         7 |    7
  16 |        14 |   14
  17 |        17 |   17
  18 |        18 |   18
(18 rows)

Parameters

Parameter Type Default Description
Edges SQL TEXT   Inner query as described bellow.

Inner query

edges SQL:an SQL query of an undirected graph, which should return a set of rows with the following columns:
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)

  • When negative: edge (source, target) does not exist, therefore it’s not part of the graph.
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, component, edge)

Column Type Description
seq INT Sequential value starting from 1.
component BIGINT Component identifier. It is equal to the minimum edge identifier in the component.
edge BIGINT Identifier of the edge.

See Also

Indices and tables